traceback: update for py311 (#7886)

This commit is contained in:
Jelle Zijlstra
2022-05-19 19:14:12 -07:00
committed by GitHub
parent 0b7df3b2aa
commit 26fa57ab78
2 changed files with 45 additions and 6 deletions

View File

@@ -96,6 +96,12 @@ def clear_frames(tb: TracebackType) -> None: ...
def walk_stack(f: FrameType | None) -> Iterator[tuple[FrameType, int]]: ...
def walk_tb(tb: TracebackType | None) -> Iterator[tuple[FrameType, int]]: ...
if sys.version_info >= (3, 11):
class _ExceptionPrintContext:
def __init__(self) -> None: ...
def indent(self) -> str: ...
def emit(self, text_gen: str | Iterable[str], margin_char: str | None = ...) -> Generator[str, None, None]: ...
class TracebackException:
__cause__: TracebackException
__context__: TracebackException
@@ -107,7 +113,34 @@ class TracebackException:
text: str
offset: int
msg: str
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 11):
def __init__(
self,
exc_type: type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType | None,
*,
limit: int | None = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
compact: bool = ...,
max_group_width: int = ...,
max_group_depth: int = ...,
_seen: set[int] | None = ...,
) -> None: ...
@classmethod
def from_exception(
cls: type[Self],
exc: BaseException,
*,
limit: int | None = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
compact: bool = ...,
max_group_width: int = ...,
max_group_depth: int = ...,
) -> Self: ...
elif sys.version_info >= (3, 10):
def __init__(
self,
exc_type: type[BaseException],
@@ -148,9 +181,16 @@ class TracebackException:
) -> Self: ...
def __eq__(self, other: object) -> bool: ...
def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...
if sys.version_info >= (3, 11):
def format(self, *, chain: bool = ..., _ctx: _ExceptionPrintContext | None = ...) -> Generator[str, None, None]: ...
else:
def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...
def format_exception_only(self) -> Generator[str, None, None]: ...
if sys.version_info >= (3, 11):
def print(self, *, file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ...
class FrameSummary(Iterable[Any]):
if sys.version_info >= (3, 11):
def __init__(
@@ -213,4 +253,7 @@ class StackSummary(list[FrameSummary]):
) -> StackSummary: ...
@classmethod
def from_list(cls, a_list: list[_PT]) -> StackSummary: ...
if sys.version_info >= (3, 11):
def format_frame_summary(self, frame_summary: FrameSummary) -> str: ...
def format(self) -> list[str]: ...

View File

@@ -97,10 +97,6 @@ symtable.SymbolTable.has_exec
sys.UnraisableHookArgs # Not exported from sys
sys.exception
tkinter._VersionInfoType.__doc__
traceback.StackSummary.format_frame_summary
traceback.TracebackException.__init__
traceback.TracebackException.format
traceback.TracebackException.print
types.ClassMethodDescriptorType.__get__
types.CodeType.co_exceptiontable
types.CodeType.co_qualname