From 7ca8303672fe3300f06c49c3e98e3bf39eef7d99 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Tue, 17 May 2022 12:49:12 -0600 Subject: [PATCH] CodeType.co_linetable is of type `bytes` (#7856) Although the specific format of the bytes is opaque and undocumented, the fact that it will be bytes is stable. This is necessary in order for type checkers to allow creating one code object from another, since the `lnotab` positional argument to `__init__` is typed as bytes. --- stdlib/types.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/types.pyi b/stdlib/types.pyi index ed2476e44..76d7bfcd0 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -308,11 +308,11 @@ class CodeType: co_cellvars: tuple[str, ...] = ..., co_filename: str = ..., co_name: str = ..., - co_linetable: object = ..., + co_linetable: bytes = ..., ) -> CodeType: ... def co_lines(self) -> Iterator[tuple[int, int, int | None]]: ... @property - def co_linetable(self) -> object: ... + def co_linetable(self) -> bytes: ... elif sys.version_info >= (3, 8): def replace( self,