Skip to content

[gdb] Complete stubs for gdb.dap #14269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brianschubert
Copy link
Member

Fill in stubs for gdb.dap, originally introduced in #12804.

Based on gdb sources at the tag gdb-15.2-release.

(PEP 764 would have been reeeally nice here)

This comment has been minimized.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and sorry for the delay. A few notes below.

moduleId: NotRequired[str | None]
source: NotRequired[Source]

class _StaceTraceResult(TypedDict):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to verify: Should this be annotated with @type_check_only as well?

Comment on lines +8 to +9
def read_json(stream: BinaryIO) -> Any: ... # returns result of json.loads
def start_json_writer(stream: BinaryIO, queue: DAPQueue[_JSONValue]) -> gdb.Thread: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a protocol (potentially an already existing one from _typeshed) instead of the semi-deprecated BinaryIO here?

from _typeshed import Incomplete, Unused
from collections.abc import Callable
from contextlib import AbstractContextManager
from typing import Any, BinaryIO, Generic, TypeVar, type_check_only
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for BinaryIO.

Comment on lines +11 to +22
@type_check_only
class ValueFormat(TypedDict, total=False):
hex: bool

@type_check_only
class ReferenceDescriptor(TypedDict):
# Result of BaseReference.to_object()
variableReference: int
name: NotRequired[str]

@type_check_only
class VariableReferenceDescriptor(ReferenceDescriptor):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are type check only, their names should start with an underscore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants