Skip to content

traceback: py313 updates #12032

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

Merged
merged 4 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 1 addition & 6 deletions stdlib/@tests/stubtest_allowlists/py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,7 @@ tkinter.Text.count
tkinter.Wm.wm_attributes
tkinter.tix
trace.CoverageResults.write_results
traceback.StackSummary.should_show_carets
traceback.TracebackException.__init__
traceback.TracebackException.exc_type
traceback.TracebackException.exc_type_str
traceback.TracebackException.format_exception_only
traceback.format_exception_only
traceback.StackSummary.should_show_carets # https://github.com/python/cpython/pull/112670#discussion_r1613952301
turtle.RawTurtle.settiltangle
turtle.__all__
turtle.settiltangle
Expand Down
72 changes: 54 additions & 18 deletions stdlib/traceback.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from _typeshed import SupportsWrite, Unused
from collections.abc import Generator, Iterable, Iterator, Mapping
from types import FrameType, TracebackType
from typing import Any, Literal, overload
from typing_extensions import Self, TypeAlias
from typing_extensions import Self, TypeAlias, deprecated

__all__ = [
"extract_stack",
Expand Down Expand Up @@ -85,7 +85,13 @@ def format_list(extracted_list: Iterable[FrameSummary | _FrameSummaryTuple]) ->
# undocumented
def print_list(extracted_list: Iterable[FrameSummary | _FrameSummaryTuple], file: SupportsWrite[str] | None = None) -> None: ...

if sys.version_info >= (3, 10):
if sys.version_info >= (3, 13):
@overload
def format_exception_only(exc: BaseException | None, /, *, show_group: bool = False) -> list[str]: ...
@overload
def format_exception_only(exc: Unused, /, value: BaseException | None, *, show_group: bool = False) -> list[str]: ...

elif sys.version_info >= (3, 10):
@overload
def format_exception_only(exc: BaseException | None, /) -> list[str]: ...
@overload
Expand All @@ -111,13 +117,20 @@ class TracebackException:
__context__: TracebackException
__suppress_context__: bool
stack: StackSummary
exc_type: type[BaseException]
filename: str
lineno: int
text: str
offset: int
msg: str
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 13):
@property
def exc_type_str(self) -> str: ...
@property
@deprecated("Deprecated in 3.13. Use exc_type_str instead.")
def exc_type(self) -> type[BaseException] | None: ...
else:
exc_type: type[BaseException]
if sys.version_info >= (3, 13):
def __init__(
self,
exc_type: type[BaseException],
Expand All @@ -130,20 +143,24 @@ class TracebackException:
compact: bool = False,
max_group_width: int = 15,
max_group_depth: int = 10,
save_exc_type: bool = True,
_seen: set[int] | None = None,
) -> None: ...
@classmethod
def from_exception(
cls,
exc: BaseException,
elif sys.version_info >= (3, 11):
def __init__(
self,
exc_type: type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType | None,
*,
limit: int | None = None,
lookup_lines: bool = True,
capture_locals: bool = False,
compact: bool = False,
max_group_width: int = 15,
max_group_depth: int = 10,
) -> Self: ...
_seen: set[int] | None = None,
) -> None: ...
elif sys.version_info >= (3, 10):
def __init__(
self,
Expand All @@ -157,6 +174,20 @@ class TracebackException:
compact: bool = False,
_seen: set[int] | None = None,
) -> None: ...
else:
def __init__(
self,
exc_type: type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType | None,
*,
limit: int | None = None,
lookup_lines: bool = True,
capture_locals: bool = False,
_seen: set[int] | None = None,
) -> None: ...

if sys.version_info >= (3, 11):
@classmethod
def from_exception(
cls,
Expand All @@ -166,19 +197,21 @@ class TracebackException:
lookup_lines: bool = True,
capture_locals: bool = False,
compact: bool = False,
max_group_width: int = 15,
max_group_depth: int = 10,
) -> Self: ...
else:
def __init__(
self,
exc_type: type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType | None,
elif sys.version_info >= (3, 10):
@classmethod
def from_exception(
cls,
exc: BaseException,
*,
limit: int | None = None,
lookup_lines: bool = True,
capture_locals: bool = False,
_seen: set[int] | None = None,
) -> None: ...
compact: bool = False,
) -> Self: ...
else:
@classmethod
def from_exception(
cls, exc: BaseException, *, limit: int | None = None, lookup_lines: bool = True, capture_locals: bool = False
Expand All @@ -190,7 +223,10 @@ class TracebackException:
else:
def format(self, *, chain: bool = True) -> Generator[str, None, None]: ...

def format_exception_only(self) -> Generator[str, None, None]: ...
if sys.version_info >= (3, 13):
def format_exception_only(self, *, show_group: bool = False, _depth: int = 0) -> Generator[str, None, None]: ...
else:
def format_exception_only(self) -> Generator[str, None, None]: ...

if sys.version_info >= (3, 11):
def print(self, *, file: SupportsWrite[str] | None = None, chain: bool = True) -> None: ...
Expand Down