Type and mark as final module-level dunders not meant to be overwritten in stdlib/ (#9709)

This commit is contained in:
Avasam
2023-02-12 11:15:20 -05:00
committed by GitHub
parent 35871f4222
commit a768744d51
8 changed files with 25 additions and 22 deletions

View File

@@ -7,7 +7,7 @@ from importlib.machinery import ModuleSpec
from io import TextIOWrapper
from types import FrameType, ModuleType, TracebackType
from typing import Any, NoReturn, Protocol, TextIO, TypeVar, overload
from typing_extensions import Literal, TypeAlias, final
from typing_extensions import Final, Literal, TypeAlias, final
_T = TypeVar("_T")
@@ -62,9 +62,10 @@ stdout: TextIO
stderr: TextIO
if sys.version_info >= (3, 10):
stdlib_module_names: frozenset[str]
__stdin__: TextIOWrapper
__stdout__: TextIOWrapper
__stderr__: TextIOWrapper
__stdin__: Final[TextIOWrapper] # Contains the original value of stdin
__stdout__: Final[TextIOWrapper] # Contains the original value of stdout
__stderr__: Final[TextIOWrapper] # Contains the original value of stderr
tracebacklimit: int
version: str
api_version: int
@@ -277,11 +278,10 @@ if sys.platform == "win32":
def intern(__string: str) -> str: ...
def is_finalizing() -> bool: ...
__breakpointhook__: Any # contains the original value of breakpointhook
def breakpointhook(*args: Any, **kwargs: Any) -> Any: ...
__breakpointhook__ = breakpointhook # Contains the original value of breakpointhook
if sys.platform != "win32":
def setdlopenflags(__flags: int) -> None: ...