Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new fields to TracebackException, fix cause/context/lineno types #13231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions stdlib/traceback.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,26 @@ 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
lineno: str | None
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
Loading