FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: Update sys.exit and SystemExit exception to have the same types by kkirsche · Pull Request #8554 · python/typeshed · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .pyi  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 3 additions & 3 deletions stdlib/builtins.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ else:
__locals: Mapping[str, object] | None = ...,
) -> None: ...

def exit(code: object = ...) -> NoReturn: ...
def exit(code: sys._ExitCode = ...) -> NoReturn: ...

class filter(Iterator[_T], Generic[_T]):
@overload
Expand Down Expand Up @@ -1620,7 +1620,7 @@ else:
@overload
def pow(__base: _SupportsSomeKindOfPow, __exp: complex, __mod: None = ...) -> complex: ...

def quit(code: object = ...) -> NoReturn: ...
def quit(code: sys._ExitCode = ...) -> NoReturn: ...

class reversed(Iterator[_T], Generic[_T]):
@overload
Expand Down Expand Up @@ -1798,7 +1798,7 @@ class GeneratorExit(BaseException): ...
class KeyboardInterrupt(BaseException): ...

class SystemExit(BaseException):
code: int
code: sys._ExitCode

class Exception(BaseException): ...

Expand Down
5 changes: 3 additions & 2 deletions stdlib/sys.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ from typing_extensions import Literal, TypeAlias, final

_T = TypeVar("_T")

# see https://github.com/python/typeshed/issues/8513#issue-1333671093 for the rationale behind this alias
_ExitCode: TypeAlias = str | int | None
_OptExcInfo: TypeAlias = OptExcInfo # noqa: Y047 # TODO: obsolete, remove fall 2022 or later

# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
Expand Down Expand Up @@ -221,8 +223,7 @@ def exc_info() -> OptExcInfo: ...
if sys.version_info >= (3, 11):
def exception() -> BaseException | None: ...

# sys.exit() accepts an optional argument of anything printable
def exit(__status: object = ...) -> NoReturn: ...
def exit(__status: _ExitCode = ...) -> NoReturn: ...
def getallocatedblocks() -> int: ...
def getdefaultencoding() -> str: ...

Expand Down

Back | FazBrowse Home | New Git URL