Skip to content

Commit 8e3110c

Browse files
authored
[gdb] Allow gdb.Value to take a Buffer plus a Type (#16006)
If a type is passed that is not None, it always goes through the buffer protocol, which interestingly means you can't pass an existing gdb.Value together with a type. You have to use the cast method for that purpose.
1 parent 8ca1ae3 commit 8e3110c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

stubs/gdb/gdb/__init__.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ class Value:
111111
def __ge__(self, other: _ValueOrNative, /) -> bool: ...
112112
def __getitem__(self, key: int | str | Field, /) -> Value: ...
113113
def __call__(self, *args: _ValueOrNative) -> Value: ...
114-
def __init__(self, val: _ValueOrNative, type: Type | None = None) -> None: ...
114+
115+
@overload
116+
def __init__(self, val: _ValueOrNative, type: None = None) -> None: ...
117+
@overload
118+
def __init__(self, val: _BufferType, type: Type) -> None: ...
119+
115120
def cast(self, type: Type) -> Value: ...
116121
def dereference(self) -> Value: ...
117122
def referenced_value(self) -> Value: ...

0 commit comments

Comments
 (0)