From e7c7bc4c2fa13b7e37b8cb8b27e8acf91a2c9797 Mon Sep 17 00:00:00 2001 From: Timo Paulssen Date: Sat, 11 Jul 2026 17:53:46 +0200 Subject: [PATCH 1/2] [gdb] Allow gdb.Value to take a Buffer plus a Type Support for this was introduced in a commit in 2019, which I think means it's been available since gdb 9.1 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. --- stubs/gdb/gdb/__init__.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stubs/gdb/gdb/__init__.pyi b/stubs/gdb/gdb/__init__.pyi index a8a5d6d79468..999396229b99 100644 --- a/stubs/gdb/gdb/__init__.pyi +++ b/stubs/gdb/gdb/__init__.pyi @@ -111,7 +111,10 @@ class Value: def __ge__(self, other: _ValueOrNative, /) -> bool: ... def __getitem__(self, key: int | str | Field, /) -> Value: ... def __call__(self, *args: _ValueOrNative) -> Value: ... - def __init__(self, val: _ValueOrNative, type: Type | None = None) -> None: ... + @overload + def __init__(self, val: _ValueOrNative, type: None = None) -> None: ... + @overload + def __init__(self, val: _BufferType, type: Type) -> None: ... def cast(self, type: Type) -> Value: ... def dereference(self) -> Value: ... def referenced_value(self) -> Value: ... From 26acbb285289e7ecce595e33f97a9ee81d0affd2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 16:27:26 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/gdb/gdb/__init__.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stubs/gdb/gdb/__init__.pyi b/stubs/gdb/gdb/__init__.pyi index 999396229b99..5911d37ab914 100644 --- a/stubs/gdb/gdb/__init__.pyi +++ b/stubs/gdb/gdb/__init__.pyi @@ -111,10 +111,12 @@ class Value: def __ge__(self, other: _ValueOrNative, /) -> bool: ... def __getitem__(self, key: int | str | Field, /) -> Value: ... def __call__(self, *args: _ValueOrNative) -> Value: ... + @overload def __init__(self, val: _ValueOrNative, type: None = None) -> None: ... @overload def __init__(self, val: _BufferType, type: Type) -> None: ... + def cast(self, type: Type) -> Value: ... def dereference(self) -> Value: ... def referenced_value(self) -> Value: ...