From aee90a0e8277e771fd0cd3ea9d646fbc182f8d40 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 29 Nov 2021 14:49:30 +0000 Subject: [PATCH] Add `CodeType.co_lines()` and `CodeType.co_linetable` (#6445) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Akuli --- stdlib/types.pyi | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/stdlib/types.pyi b/stdlib/types.pyi index c0f274538..a96623c5c 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -123,7 +123,30 @@ class CodeType: freevars: Tuple[str, ...] = ..., cellvars: Tuple[str, ...] = ..., ) -> None: ... - if sys.version_info >= (3, 8): + if sys.version_info >= (3, 10): + def replace( + self, + *, + co_argcount: int = ..., + co_posonlyargcount: int = ..., + co_kwonlyargcount: int = ..., + co_nlocals: int = ..., + co_stacksize: int = ..., + co_flags: int = ..., + co_firstlineno: int = ..., + co_code: bytes = ..., + co_consts: Tuple[Any, ...] = ..., + co_names: Tuple[str, ...] = ..., + co_varnames: Tuple[str, ...] = ..., + co_freevars: Tuple[str, ...] = ..., + co_cellvars: Tuple[str, ...] = ..., + co_filename: str = ..., + co_name: str = ..., + co_linetable: object = ..., + ) -> CodeType: ... + def co_lines(self) -> Iterator[tuple[int, int, int | None]]: ... + co_linetable: object + elif sys.version_info >= (3, 8): def replace( self, *,