Skip to content

Commit

Permalink
Add new fields to TracebackException, fix cause/context/lineno types
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinji committed Dec 11, 2024
1 parent 2666d3b commit 225fc22
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions stdlib/traceback.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,29 @@ if sys.version_info >= (3, 11):
def emit(self, text_gen: str | Iterable[str], margin_char: str | None = None) -> Generator[str, None, None]: ...

class TracebackException:
__cause__: TracebackException
__context__: TracebackException
__cause__: TracebackException | None
__context__: TracebackException | None
if sys.version_info >= (3, 11):
exceptions: list[TracebackException] | None
__suppress_context__: bool
if sys.version_info >= (3, 11):
__notes__: list[str] | None
stack: StackSummary

# These fields only exist for `SyntaxError`s, but there is no way to express that in the type system.
filename: str
lineno: int
if sys.version_info >= (3, 10):
lineno: str | None
else:
lineno: str
if sys.version_info >= (3, 10):
end_lineno: str | None
text: str
offset: int
if sys.version_info >= (3, 10):
end_offset: int | None
msg: str

if sys.version_info >= (3, 13):
@property
def exc_type_str(self) -> str: ...
Expand Down

0 comments on commit 225fc22

Please sign in to comment.