From 31495e53bd977c8cdf5dcd806d14655af5c9ceeb Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 19 Sep 2023 23:24:22 -0700 Subject: [PATCH] typing.pyi: IO.name may be bytes (#10738) --- stdlib/typing.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 2c1ebe6d7..6deb0ffd0 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -709,8 +709,10 @@ class IO(Iterator[AnyStr], Generic[AnyStr]): # See #8726 @property def mode(self) -> str: ... + # Usually str, but may be bytes if a bytes path was passed to open(). See #10737. + # If PEP 696 becomes available, we may want to use a defaulted TypeVar here. @property - def name(self) -> str: ... + def name(self) -> str | Any: ... @abstractmethod def close(self) -> None: ... @property