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.
This commit is contained in:
Carl Meyer authored and GitHub committed 2022-05-17 11:49:12 -07:00
1 parent 171ea08f0d
commit 7ca8303672
1 file changed
+2 -2
+2 -2
View File
@@ -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,