mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 14:46:55 +08:00
Marked the std streams as possibly be None (#11826)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import OptExcInfo, ProfileFunction, TraceFunction, structseq
|
||||
from _typeshed import MaybeNone, OptExcInfo, ProfileFunction, TraceFunction, structseq
|
||||
from _typeshed.importlib import MetaPathFinderProtocol, PathEntryFinderProtocol
|
||||
from builtins import object as _object
|
||||
from collections.abc import AsyncGenerator, Callable, Sequence
|
||||
@@ -56,23 +56,24 @@ ps2: object
|
||||
|
||||
# TextIO is used instead of more specific types for the standard streams,
|
||||
# since they are often monkeypatched at runtime. At startup, the objects
|
||||
# are initialized to instances of TextIOWrapper.
|
||||
# are initialized to instances of TextIOWrapper, but can also be None under
|
||||
# some circumstances.
|
||||
#
|
||||
# To use methods from TextIOWrapper, use an isinstance check to ensure that
|
||||
# the streams have not been overridden:
|
||||
#
|
||||
# if isinstance(sys.stdout, io.TextIOWrapper):
|
||||
# sys.stdout.reconfigure(...)
|
||||
stdin: TextIO
|
||||
stdout: TextIO
|
||||
stderr: TextIO
|
||||
stdin: TextIO | MaybeNone
|
||||
stdout: TextIO | MaybeNone
|
||||
stderr: TextIO | MaybeNone
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
stdlib_module_names: frozenset[str]
|
||||
|
||||
__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
|
||||
__stdin__: Final[TextIOWrapper | None] # Contains the original value of stdin
|
||||
__stdout__: Final[TextIOWrapper | None] # Contains the original value of stdout
|
||||
__stderr__: Final[TextIOWrapper | None] # Contains the original value of stderr
|
||||
tracebacklimit: int
|
||||
version: str
|
||||
api_version: int
|
||||
|
||||
Reference in New Issue
Block a user