From f8cad24c2d5a9eef9ff0a6d3bb72e6f0297558ce Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 11 Dec 2023 01:28:23 -0800 Subject: [PATCH 1/2] follow implementation details of dis.Instruction related (vaugely) to https://github.com/python/typeshed/issues/3968 --- stdlib/dis.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stdlib/dis.pyi b/stdlib/dis.pyi index ab101a517a6f..31cd1eeb9ac8 100644 --- a/stdlib/dis.pyi +++ b/stdlib/dis.pyi @@ -48,7 +48,7 @@ if sys.version_info >= (3, 11): end_col_offset: int | None = None if sys.version_info >= (3, 11): - class Instruction(NamedTuple): + class _Instruction(NamedTuple): opname: str opcode: int arg: int | None @@ -60,7 +60,7 @@ if sys.version_info >= (3, 11): positions: Positions | None = None else: - class Instruction(NamedTuple): + class _Instruction(NamedTuple): opname: str opcode: int arg: int | None @@ -70,6 +70,9 @@ else: starts_line: int | None is_jump_target: bool +class Instruction(_Instruction): + def _disassemble(self, lineno_width: int = ..., mark_as_current: bool = ..., offset_width: int = ...) -> str: ... + class Bytecode: codeobj: types.CodeType first_line: int From 652559c20cb6aac43feba2c3cf63f3d815bd4ca8 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 11 Dec 2023 09:49:29 -0800 Subject: [PATCH 2/2] add defaults Co-authored-by: Sebastian Rittau --- stdlib/dis.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/dis.pyi b/stdlib/dis.pyi index 31cd1eeb9ac8..796d81d8bf70 100644 --- a/stdlib/dis.pyi +++ b/stdlib/dis.pyi @@ -71,7 +71,7 @@ else: is_jump_target: bool class Instruction(_Instruction): - def _disassemble(self, lineno_width: int = ..., mark_as_current: bool = ..., offset_width: int = ...) -> str: ... + def _disassemble(self, lineno_width: int = 3, mark_as_current: bool = False, offset_width: int = 4) -> str: ... class Bytecode: codeobj: types.CodeType