Skip to content

Commit de2a427

Browse files
guociAlexWaygood
andauthored
Add type stub for sys._current_exceptions (#14937)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent eb746be commit de2a427

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stdlib/sys/__init__.pyi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ else:
354354
def _current_frames() -> dict[int, FrameType]: ...
355355
def _getframe(depth: int = 0, /) -> FrameType: ...
356356

357+
# documented -- see https://docs.python.org/3/library/sys.html#sys._current_exceptions
358+
if sys.version_info >= (3, 12):
359+
def _current_exceptions() -> dict[int, BaseException | None]: ...
360+
361+
else:
362+
def _current_exceptions() -> dict[int, OptExcInfo]: ...
363+
357364
if sys.version_info >= (3, 12):
358365
def _getframemodulename(depth: int = 0) -> str | None: ...
359366

0 commit comments

Comments
 (0)