diff --git a/stdlib/@tests/stubtest_allowlists/py312.txt b/stdlib/@tests/stubtest_allowlists/py312.txt index c9bfee549..685a1bf41 100644 --- a/stdlib/@tests/stubtest_allowlists/py312.txt +++ b/stdlib/@tests/stubtest_allowlists/py312.txt @@ -7,8 +7,6 @@ # >= 3.12 # ======= -zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in different Python versions - # Initialized at runtime typing_extensions.TypeAliasType.__parameters__ typing_extensions.TypeAliasType.__value__ diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index 7cd834acf..282b91348 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -12,8 +12,6 @@ # >= 3.12 # ======= -zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in different Python versions - # Initialized at runtime typing_extensions.TypeAliasType.__parameters__ typing_extensions.TypeAliasType.__value__ diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index e376fbe82..53dd45eac 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -50,8 +50,6 @@ functools.partialmethod.__new__ # >= 3.12 # ======= -zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in different Python versions - # Types that require `__setattr__` and `__delattr__` for typing purposes: types.SimpleNamespace.__setattr__ types.SimpleNamespace.__delattr__ diff --git a/stdlib/zoneinfo/__init__.pyi b/stdlib/zoneinfo/__init__.pyi index 35381758a..e9f54fbf2 100644 --- a/stdlib/zoneinfo/__init__.pyi +++ b/stdlib/zoneinfo/__init__.pyi @@ -1,3 +1,4 @@ +import sys from collections.abc import Iterable from datetime import datetime, timedelta, tzinfo from typing_extensions import Self @@ -17,8 +18,13 @@ class ZoneInfo(tzinfo): def __new__(cls, key: str) -> Self: ... @classmethod def no_cache(cls, key: str) -> Self: ... - @classmethod - def from_file(cls, fobj: _IOBytes, /, key: str | None = None) -> Self: ... + if sys.version_info >= (3, 12): + @classmethod + def from_file(cls, file_obj: _IOBytes, /, key: str | None = None) -> Self: ... + else: + @classmethod + def from_file(cls, fobj: _IOBytes, /, key: str | None = None) -> Self: ... + @classmethod def clear_cache(cls, *, only_keys: Iterable[str] | None = None) -> None: ... def tzname(self, dt: datetime | None, /) -> str | None: ...