Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9dcadd2

Browse files
authored
Overload gdb.execute return type (#11638)
1 parent 3d26992 commit 9dcadd2

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

stubs/gdb/gdb/__init__.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import _typeshed
66
from collections.abc import Callable, Iterator, Sequence
77
from contextlib import AbstractContextManager
8-
from typing import Protocol, final, overload
8+
from typing import Literal, Protocol, final, overload
99
from typing_extensions import TypeAlias
1010

1111
import gdb.types
@@ -23,7 +23,14 @@ STDOUT: int
2323
STDERR: int
2424
STDLOG: int
2525

26-
def execute(command: str, from_tty: bool = ..., to_string: bool = ...) -> str | None: ...
26+
@overload
27+
def execute(command: str, from_tty: bool = False, to_string: Literal[False] = False) -> None: ...
28+
@overload
29+
def execute(command: str, *, to_string: Literal[True]) -> str: ...
30+
@overload
31+
def execute(command: str, from_tty: bool, to_string: Literal[True]) -> str: ...
32+
@overload
33+
def execute(command: str, from_tty: bool = False, to_string: bool = False) -> str | None: ...
2734
def breakpoints() -> Sequence[Breakpoint]: ...
2835
def rbreak(regex: str, minsyms: bool = ..., throttle: int = ..., symtabs: Iterator[Symtab] = ...) -> list[Breakpoint]: ...
2936
def parameter(parameter: str, /) -> bool | int | str | None: ...

0 commit comments

Comments
 (0)