diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index befbc32682c5..38c71e3d1177 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -464,6 +464,9 @@ unittest.runner._WritelnDecorator.write # Methods that come from __getattr__() urllib.response.addbase.write # Methods that come from __getattr__() at runtime urllib.response.addbase.writelines # Methods that come from __getattr__() at runtime +(hashlib.__all__)? # scrypt depends on how OpenSSL was built. +(pydoc.Doc.getdocloc)? # Runtime default is an installation-specific stdlib path. + _?weakref\.CallableProxyType\.__getattr__ # Should have all attributes of proxy _?weakref\.(ref|ReferenceType)\.__init__ # C implementation has incorrect signature _?weakref\.(ref|ReferenceType)\.__call__ # C function default annotation is wrong diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py315.txt b/stdlib/@tests/stubtest_allowlists/darwin-py315.txt index 0f5b248ad72b..9463929265d0 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py315.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py315.txt @@ -1,22 +1,25 @@ -# ============================================ -# TODO: Allowlist entries that should be fixed -# ============================================ +# ============================================================= +# Allowlist entries that cannot or should not be fixed; >= 3.15 +# ============================================================= -_pyrepl.fancy_termios -_pyrepl.unix_console -_pyrepl.unix_eventqueue +# Depends on the ncurses version used to build Python. +(_curses.BUTTON5_CLICKED)? +(_curses.BUTTON5_DOUBLE_CLICKED)? +(_curses.BUTTON5_PRESSED)? +(_curses.BUTTON5_RELEASED)? +(_curses.BUTTON5_TRIPLE_CLICKED)? + +# Platform/build availability differs across Darwin builds. +(_socket.SO_BINDTODEVICE)? +(errno.ENOTCAPABLE)? + +# Runtime metadata for new ctypes complex types is not useful for static checking. ctypes.c_double_complex._type_ ctypes.c_float_complex._type_ ctypes.c_longdouble_complex._type_ -os.NODEV -os.__all__ -posix.NODEV -readline.get_pre_input_hook - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; >= 3.15 -# ============================================================= +# Depends on how readline was built. +readline.get_pre_input_hook # Internal implementation details of the sampling profiler. profiling.sampling.live_collector diff --git a/stdlib/@tests/stubtest_allowlists/darwin.txt b/stdlib/@tests/stubtest_allowlists/darwin.txt index f1eb01ce62a5..3bc2b5d4212e 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin.txt @@ -45,6 +45,7 @@ tkinter.Tk.deletefilehandler # Methods that come from __getattr__() at runtime # These entries looks like a `setup-python` bug: (dbm.gnu)? +(mmap.mmap.resize)? (_?locale.bind_textdomain_codeset)? (_?locale.bindtextdomain)? (_?locale.dcgettext)? diff --git a/stdlib/@tests/stubtest_allowlists/linux-py315.txt b/stdlib/@tests/stubtest_allowlists/linux-py315.txt index fe1f0d179656..086d488f53c9 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py315.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py315.txt @@ -2,21 +2,10 @@ # TODO: Allowlist entries that should be fixed # ============================================ -# GitHub Actions' Python 3.15 Linux build currently lacks _decimal, so -# decimal falls back to _pydecimal with different runtime signatures. -decimal\..* -_decimal -_pyrepl.fancy_termios -_pyrepl.unix_console -_pyrepl.unix_eventqueue -ctypes.c_double_complex._type_ -ctypes.c_float_complex._type_ -ctypes.c_longdouble_complex._type_ os.AT_NO_AUTOMOUNT os.AT_STATX_DONT_SYNC os.AT_STATX_FORCE_SYNC os.AT_STATX_SYNC_AS_STAT -os.NODEV os.STATX_ATIME os.STATX_BASIC_STATS os.STATX_BLOCKS @@ -41,7 +30,6 @@ posix.AT_NO_AUTOMOUNT posix.AT_STATX_DONT_SYNC posix.AT_STATX_FORCE_SYNC posix.AT_STATX_SYNC_AS_STAT -posix.NODEV posix.STATX_ATIME posix.STATX_BASIC_STATS posix.STATX_BLOCKS @@ -59,13 +47,25 @@ posix.STATX_SIZE posix.STATX_TYPE posix.STATX_UID posix.statx -readline.get_pre_input_hook # ============================================================= # Allowlist entries that cannot or should not be fixed; >= 3.15 # ============================================================= +# GitHub Actions' Python 3.15 Linux build currently lacks _decimal, so +# decimal falls back to _pydecimal with different runtime signatures. +decimal\..* +_decimal + +# Runtime metadata for new ctypes complex types is not useful for static checking. +ctypes.c_double_complex._type_ +ctypes.c_float_complex._type_ +ctypes.c_longdouble_complex._type_ + +# Depends on how readline was built. +readline.get_pre_input_hook + # Internal implementation details of the sampling profiler. profiling.sampling.live_collector profiling.sampling.live_collector.collector diff --git a/stdlib/@tests/stubtest_allowlists/py315.txt b/stdlib/@tests/stubtest_allowlists/py315.txt index edd78a8b2fc4..46d07155b752 100644 --- a/stdlib/@tests/stubtest_allowlists/py315.txt +++ b/stdlib/@tests/stubtest_allowlists/py315.txt @@ -12,143 +12,41 @@ _frozen_importlib_external.SourceFileLoader.source_to_code _frozen_importlib_external.SourceLoader.source_to_code _frozen_importlib_external._LoaderBasics.load_module _frozen_importlib_external.cache_from_source -_pyrepl.base_eventqueue -_pyrepl.commands -_pyrepl.completing_reader -_pyrepl.console -_pyrepl.content -_pyrepl.fancycompleter -_pyrepl.historical_reader -_pyrepl.input -_pyrepl.keymap -_pyrepl.layout -_pyrepl.main -_pyrepl.pager -_pyrepl.reader -_pyrepl.readline -_pyrepl.render -_pyrepl.simple_interact -_pyrepl.terminfo -_pyrepl.trace -_pyrepl.types -_pyrepl.utils -_pyrepl.windows_console -_pyrepl.windows_eventqueue _struct.Struct.pack_into _struct.pack _struct.pack_into _thread.RLock.__exit__ _thread.lock.__exit__ -annotationlib.ForwardRef.__arg__ -annotationlib.ForwardRef.__ast_node__ -annotationlib.ForwardRef.__cell__ -annotationlib.ForwardRef.__code__ -annotationlib.ForwardRef.__extra_names__ -annotationlib.ForwardRef.__globals__ -annotationlib.ForwardRef.__init_subclass__ -annotationlib.ForwardRef.__owner__ -annotationlib.ForwardRef.__stringifier_dict__ -ast.type_param.__init__ -# base64.b64decode uses a private sentinel list as the default for parameters whose public types are bool/buffer. -base64.b64decode -codecs.backslashreplace_errors -codecs.ignore_errors -codecs.namereplace_errors -codecs.replace_errors -codecs.strict_errors -codecs.xmlcharrefreplace_errors -concurrent.interpreters._crossinterp.UNBOUND_ERROR -concurrent.interpreters._crossinterp.UNBOUND_REMOVE -concurrent.interpreters._crossinterp.UnboundItem.singleton -concurrent.interpreters._crossinterp.classonly -concurrent.interpreters._crossinterp.classonly.__class_getitem__ -concurrent.interpreters._crossinterp.classonly.__func__ -concurrent.interpreters._crossinterp.classonly.__get__ -concurrent.interpreters._crossinterp.classonly.__init__ -concurrent.interpreters._crossinterp.classonly.__isabstractmethod__ -concurrent.interpreters._crossinterp.classonly.__set_name__ -concurrent.interpreters._crossinterp.classonly.__wrapped__ copy.deepcopy dataclasses._MISSING_TYPE dataclasses.MISSING dataclasses.field doctest.DocTestRunner.report_skip enum.__all__ -enum.auto.__init__ -enum.auto.value -functools.partialmethod.__new__ -http.HTTPMethod.description importlib._abc.Loader.load_module importlib._bootstrap_external.NamespacePath importlib.abc.InspectLoader.source_to_code importlib.abc.MetaPathFinder.discover importlib.abc.PathEntryFinder.discover -importlib.resources._common.files importlib.resources._common.package_to_anchor -importlib.resources.abc.Traversable.open -inspect._ParameterKind.description -io.Reader.__class_getitem__ -io.Reader.read -io.Writer.__class_getitem__ -io.Writer.write mailbox.Mailbox.__enter__ mailbox.Mailbox.__exit__ mailbox._ProxyFile.__class_getitem__ -multiprocessing.managers.BaseListProxy.clear -multiprocessing.managers.BaseListProxy.copy -multiprocessing.managers._BaseDictProxy.__iter__ -multiprocessing.managers._BaseDictProxy.__len__ -multiprocessing.managers._BaseDictProxy.__reversed__ -multiprocessing.managers._BaseDictProxy.clear -multiprocessing.managers._BaseDictProxy.copy -multiprocessing.managers._BaseDictProxy.items -multiprocessing.managers._BaseDictProxy.keys -multiprocessing.managers._BaseDictProxy.popitem -multiprocessing.managers._BaseDictProxy.values -multiprocessing.managers._BaseSetProxy.__iter__ -multiprocessing.managers._BaseSetProxy.__len__ -multiprocessing.managers._BaseSetProxy.clear -multiprocessing.managers._BaseSetProxy.copy -multiprocessing.managers._BaseSetProxy.pop multiprocessing.process.BaseProcess.__init__ -sre_compile -sre_constants -sre_parse -sys.__jit -sys._monitoring -sys.last_exc threading.Condition.locked tkinter.Image.__iter__ tkinter.Misc.__iter__ tkinter.font.Font.__iter__ tkinter.simpledialog.__all__ -types.MappingProxyType.get -types.SimpleNamespace.__delattr__ -types.SimpleNamespace.__setattr__ -types.UnionType.__class_getitem__ -types.UnionType.__mro_entries__ -types.UnionType.__name__ -types.UnionType.__qualname__ -typing.LiteralString -typing.NewType.__mro_entries__ -typing.ParamSpec.__mro_entries__ -typing.ParamSpecArgs.__mro_entries__ -typing.ParamSpecKwargs.__mro_entries__ -typing.SupportsAbs.__type_params__ -typing.SupportsRound.__type_params__ -typing.TypeVar.__mro_entries__ -typing.TypeVarTuple.__mro_entries__ -typing.Union -typing._SpecialForm.__mro_entries__ typing_extensions.__all__ -typing_extensions.Protocol xml.etree.ElementTree.__all__ # ============================================================= -# Allowlist entries that cannot or should not be fixed; >=3.15 +# Allowlist entries that cannot or should not be fixed; >= 3.15 # ============================================================= # runtime default is a list object used as a sentinel +base64.b64decode urllib.parse.urlunparse urllib.parse.urlunsplit @@ -191,3 +89,130 @@ tkinter.Pack.content tkinter.Pack.pack_content tkinter.Place.content tkinter.Place.place_content + + +# ============================================================= +# Allowlist entries that cannot or should not be fixed; >= 3.14 +# ============================================================= + +# Undocumented private attributes +.*\.ForwardRef\.__arg__ +.*\.ForwardRef\.__ast_node__ +.*\.ForwardRef\.__cell__ +.*\.ForwardRef\.__code__ +.*\.ForwardRef\.__extra_names__ +.*\.ForwardRef\.__globals__ +.*\.ForwardRef\.__init_subclass__ +.*\.ForwardRef\.__owner__ +.*\.ForwardRef\.__stringifier_dict__ + +# Runtime AST node runtime constructor behaviour is too loose. +# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378). +# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858). +_?ast.type_param.__init__ + +# Decorator approximated by classmethod +concurrent.interpreters._crossinterp.classonly.* +# Method using this decorator +concurrent.interpreters._crossinterp.UnboundItem.singleton + +# object() sentinels at runtime represented by NewTypes in the stubs +concurrent.interpreters._crossinterp.UNBOUND_ERROR +concurrent.interpreters._crossinterp.UNBOUND_REMOVE + +# Assigning `__new__` causes `func` not to get recognized. +functools.partialmethod.__new__ + +# These protocols use ABC hackery at runtime. +(io|typing_extensions)\.Reader\.__class_getitem__ +(io|typing_extensions)\.Reader\.read +(io|typing_extensions)\.Writer\.__class_getitem__ +(io|typing_extensions)\.Writer\.write + +# These multiprocessing proxy methods have *args, **kwargs signatures at runtime, +# but have more precise (accurate) signatures in the stub. +multiprocessing.managers.BaseListProxy.clear +multiprocessing.managers.BaseListProxy.copy +multiprocessing.managers._BaseDictProxy.__reversed__ +multiprocessing.managers._BaseSetProxy.__iter__ +multiprocessing.managers._BaseSetProxy.__len__ +multiprocessing.managers._BaseSetProxy.clear +multiprocessing.managers._BaseSetProxy.copy +multiprocessing.managers._BaseSetProxy.pop + +# Union and UnionType are aliases in 3.14 but type checkers need some changes. +typing.Union +types.UnionType.__class_getitem__ +types.UnionType.__mro_entries__ +types.UnionType.__name__ +types.UnionType.__qualname__ + + +# ============================================================= +# Allowlist entries that cannot or should not be fixed; >= 3.13 +# ============================================================= + +_pyrepl\..+ # The internal implementation of the REPL on py313+; not for public consumption +codecs.backslashreplace_errors # Runtime incorrectly has `self` +codecs.ignore_errors # Runtime incorrectly has `self` +codecs.namereplace_errors # Runtime incorrectly has `self` +codecs.replace_errors # Runtime incorrectly has `self` +codecs.strict_errors # Runtime incorrectly has `self` +codecs.xmlcharrefreplace_errors # Runtime incorrectly has `self` + +# These multiprocessing proxy methods have *args, **kwargs signatures at runtime, +# but have more precise (accurate) signatures in the stub. +multiprocessing.managers._BaseDictProxy.__iter__ +multiprocessing.managers._BaseDictProxy.__len__ +multiprocessing.managers._BaseDictProxy.clear +multiprocessing.managers._BaseDictProxy.copy +multiprocessing.managers._BaseDictProxy.items +multiprocessing.managers._BaseDictProxy.keys +multiprocessing.managers._BaseDictProxy.popitem +multiprocessing.managers._BaseDictProxy.values + +# To match `dict`, we lie about the runtime, but use overloads to match the correct behavior. +types.MappingProxyType.get + +typing_extensions.Protocol # Super-special typing primitive + + +# ============================================================= +# Allowlist entries that cannot or should not be fixed; >= 3.12 +# ============================================================= + +# Deprecated argument is supported at runtime by renaming it through a decorator. +importlib.resources._common.files + +sys._monitoring # Doesn't really exist. See comments in the stub. +sys.__jit # Similar to sys._monitoring +sys.last_exc # Not always defined. + +# Types that require `__setattr__` and `__delattr__` for typing purposes. +types.SimpleNamespace.__delattr__ +types.SimpleNamespace.__setattr__ + +# These only exist to give a better error message if you try to subclass an instance. +typing.ParamSpec.__mro_entries__ +typing.ParamSpecArgs.__mro_entries__ +typing.ParamSpecKwargs.__mro_entries__ +typing.TypeVar.__mro_entries__ +typing.TypeVarTuple.__mro_entries__ + +# These exist at runtime because the protocol uses PEP 695 syntax in CPython. +typing.SupportsAbs.__type_params__ +typing.SupportsRound.__type_params__ + + +# ============================================================= +# Allowlist entries that cannot or should not be fixed; >= 3.11 +# ============================================================= + +enum.auto.__init__ # The stub for enum.auto is nothing like the implementation +enum.auto.value # The stub for enum.auto is nothing like the implementation +http.HTTPMethod.description # Mutable instance attribute at runtime but we pretend it's a property +importlib.resources.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments. +inspect._ParameterKind.description # Still exists, but stubtest can't see it +typing.LiteralString # Super-special typing primitive +typing.NewType.__mro_entries__ # Only exists for an error message. +typing._SpecialForm.__mro_entries__ # Super-special typing primitive diff --git a/stdlib/@tests/stubtest_allowlists/win32-py315.txt b/stdlib/@tests/stubtest_allowlists/win32-py315.txt index 1e9f5fdb0f3c..920abaee5212 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py315.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py315.txt @@ -12,5 +12,17 @@ _winapi.EVENTLOG_WARNING_TYPE _winapi.GetOEMCP _winapi.RegisterEventSource _winapi.ReportEvent -asyncio.windows_events.IocpProactor.finish_socket_func winreg.DeleteTree + + +# ============================================================= +# Allowlist entries that cannot or should not be fixed; >= 3.15 +# ============================================================= + +# Depends on whether the C _decimal extension or pure-Python fallback is used. +(_decimal.SPEC_VERSION)? +(decimal.SPEC_VERSION)? + +# Undocumented internal method, not really for public consumption. +# Hard to add types for unless we add stubs for the undocumented _overlapped module. +asyncio.windows_events.IocpProactor.finish_socket_func diff --git a/stdlib/VERSIONS b/stdlib/VERSIONS index 14f064ef0c52..e9c8d91fdbd7 100644 --- a/stdlib/VERSIONS +++ b/stdlib/VERSIONS @@ -281,9 +281,9 @@ socket: 3.0- socketserver: 3.0- spwd: 3.0-3.12 sqlite3: 3.0- -sre_compile: 3.0- -sre_constants: 3.0- -sre_parse: 3.0- +sre_compile: 3.0-3.14 +sre_constants: 3.0-3.14 +sre_parse: 3.0-3.14 ssl: 3.0- stat: 3.0- statistics: 3.4- diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 506623905a9d..95f1f862a391 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -447,7 +447,9 @@ if sys.platform != "win32" and sys.version_info >= (3, 13): __all__ += ["grantpt", "posix_openpt", "ptsname", "unlockpt"] if sys.platform != "win32" and sys.version_info >= (3, 11): __all__ += ["login_tty"] -if sys.platform != "win32": +if sys.platform != "win32" and sys.version_info >= (3, 15): + __all__ += ["NODEV", "O_FSYNC"] +elif sys.platform != "win32": __all__ += ["O_FSYNC"] if sys.platform != "darwin" and sys.platform != "win32": __all__ += [ @@ -667,6 +669,9 @@ if sys.platform == "darwin": O_NOFOLLOW_ANY: Final[int] O_SYMLINK: Final[int] +if sys.platform != "win32" and sys.version_info >= (3, 15): + NODEV: Final[int] + if sys.platform != "win32": O_FSYNC: Final[int] diff --git a/stdlib/posix.pyi b/stdlib/posix.pyi index f3e96f0c095c..d6f28e82690e 100644 --- a/stdlib/posix.pyi +++ b/stdlib/posix.pyi @@ -263,6 +263,9 @@ if sys.platform != "win32": if sys.platform != "linux" and sys.version_info >= (3, 13): from os import O_EXEC as O_EXEC, O_SEARCH as O_SEARCH + if sys.version_info >= (3, 15): + from os import NODEV as NODEV + if sys.platform != "darwin": from os import ( POSIX_FADV_DONTNEED as POSIX_FADV_DONTNEED,