diff --git a/stdlib/_winapi.pyi b/stdlib/_winapi.pyi index 1c0932667..259293c51 100644 --- a/stdlib/_winapi.pyi +++ b/stdlib/_winapi.pyi @@ -105,6 +105,24 @@ if sys.platform == "win32": WAIT_ABANDONED_0: Literal[128] WAIT_OBJECT_0: Literal[0] WAIT_TIMEOUT: Literal[258] + + if sys.version_info >= (3, 11): + LOCALE_NAME_INVARIANT: str + LOCALE_NAME_MAX_LENGTH: int + LOCALE_NAME_SYSTEM_DEFAULT: str + LOCALE_NAME_USER_DEFAULT: str | None + + LCMAP_FULLWIDTH: int + LCMAP_HALFWIDTH: int + LCMAP_HIRAGANA: int + LCMAP_KATAKANA: int + LCMAP_LINGUISTIC_CASING: int + LCMAP_LOWERCASE: int + LCMAP_SIMPLIFIED_CHINESE: int + LCMAP_TITLECASE: int + LCMAP_TRADITIONAL_CHINESE: int + LCMAP_UPPERCASE: int + def CloseHandle(__handle: int) -> None: ... @overload def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ... @@ -163,6 +181,9 @@ if sys.platform == "win32": def GetVersion() -> int: ... def OpenProcess(__desired_access: int, __inherit_handle: bool, __process_id: int) -> int: ... def PeekNamedPipe(__handle: int, __size: int = ...) -> tuple[int, int] | tuple[bytes, int, int]: ... + if sys.version_info >= (3, 11): + def LCMapStringEx(locale: str, flags: int, src: str) -> str: ... + @overload def ReadFile(handle: int, size: int, overlapped: Literal[True]) -> tuple[Overlapped, int]: ... @overload diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index a1739b7bd..44595d5ae 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -217,8 +217,14 @@ def enable_callback_tracebacks(__enable: bool) -> None: ... # takes a pos-or-keyword argument because there is a C wrapper def enable_shared_cache(enable: int) -> None: ... -def register_adapter(__type: type[_T], __caster: _Adapter[_T]) -> None: ... -def register_converter(__name: str, __converter: _Converter) -> None: ... + +if sys.version_info >= (3, 11): + def register_adapter(__type: type[_T], __adapter: _Adapter[_T]) -> None: ... + def register_converter(__typename: str, __converter: _Converter) -> None: ... + +else: + def register_adapter(__type: type[_T], __caster: _Adapter[_T]) -> None: ... + def register_converter(__name: str, __converter: _Converter) -> None: ... if sys.version_info < (3, 8): class Cache: diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index e6d28338d..980505271 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -1,6 +1,6 @@ import collections # Needed by aliases like DefaultDict, see mypy issue 2986 import sys -from _typeshed import IdentityFunction, ReadableBuffer, Self as TypeshedSelf, SupportsKeysAndGetItem +from _typeshed import IdentityFunction, Incomplete, ReadableBuffer, Self as TypeshedSelf, SupportsKeysAndGetItem from abc import ABCMeta, abstractmethod from types import ( BuiltinFunctionType, @@ -138,6 +138,8 @@ class TypeVar: if sys.version_info >= (3, 10): def __or__(self, right: Any) -> _SpecialForm: ... def __ror__(self, left: Any) -> _SpecialForm: ... + if sys.version_info >= (3, 11): + def __typing_subst__(self, arg: Incomplete) -> Incomplete: ... # Used for an undocumented mypy feature. Does not exist at runtime. _promote = object() @@ -192,6 +194,8 @@ if sys.version_info >= (3, 11): __name__: str def __init__(self, name: str) -> None: ... def __iter__(self) -> Any: ... + def __typing_subst__(self, arg: Never) -> Never: ... + def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ... if sys.version_info >= (3, 10): class ParamSpecArgs: @@ -212,6 +216,10 @@ if sys.version_info >= (3, 10): def args(self) -> ParamSpecArgs: ... @property def kwargs(self) -> ParamSpecKwargs: ... + if sys.version_info >= (3, 11): + def __typing_subst__(self, arg: Incomplete) -> Incomplete: ... + def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ... + def __or__(self, right: Any) -> _SpecialForm: ... def __ror__(self, left: Any) -> _SpecialForm: ... Concatenate: _SpecialForm diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 8412dc452..b370842a5 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -168,3 +168,10 @@ ast.ImportFrom.level # None on the class, but never None on instances # White lies around defaults dataclasses.KW_ONLY + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +builtins.classmethod.__get__ +builtins.property.__get__ +builtins.staticmethod.__get__ +types.FunctionType.__get__ +types.LambdaType.__get__ diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 59acbe6db..83f66431b 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -46,9 +46,6 @@ tkinter._VersionInfoType.__doc__ typing.ForwardRef._evaluate typing.NewType.__call__ typing.NewType.__mro_entries__ -typing.ParamSpec.__typing_subst__ -typing.TypeVar.__typing_subst__ -typing.TypeVarTuple.__typing_subst__ weakref.WeakValueDictionary.update # stubtest complains that in 3.10 the default argument is inconsistent with the annotation, @@ -153,6 +150,12 @@ ast.ImportFrom.level # None on the class, but never None on instances contextlib.AbstractAsyncContextManager.__class_getitem__ contextlib.AbstractContextManager.__class_getitem__ +# The argument to is_python_build() is deprecated since Python 3.11 and +# has a default value of None to check for its existence and warn if it's +# supplied. None is not supposed to be passed by user code and therefore +# not included in the stubs. +sysconfig.is_python_build + # Super-special typing primitives typing._SpecialForm.__mro_entries__ typing._TypedDict.__delitem__ @@ -176,8 +179,8 @@ wsgiref.types.InputStream.readlines wsgiref.types.StartResponse.__call__ wsgiref.types._Readable.read +# https://github.com/python/mypy/issues/13114 +wsgiref.types.WSGIEnvironment + # https://github.com/python/mypy/issues/12821 (stubtest bug with Callable type alias) wsgiref.types.WSGIApplication - -# Really it's mad about dict.get -wsgiref.types.WSGIEnvironment.get diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index ce9e438f5..8f3eb69e8 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -153,3 +153,10 @@ pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - funct xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args pyexpat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322) xml.parsers.expat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322) + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +builtins.classmethod.__get__ +builtins.property.__get__ +builtins.staticmethod.__get__ +types.FunctionType.__get__ +types.LambdaType.__get__ diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 920e672f4..e50a633a3 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -170,3 +170,10 @@ queue.SimpleQueue.__init__ uuid.getnode # undocumented, unused parameter getters that was later removed types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +builtins.classmethod.__get__ +builtins.property.__get__ +builtins.staticmethod.__get__ +types.FunctionType.__get__ +types.LambdaType.__get__ diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index de0d7d9ee..5783e943d 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -169,3 +169,10 @@ ast.ImportFrom.level # None on the class, but never None on instances ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +builtins.classmethod.__get__ +builtins.property.__get__ +builtins.staticmethod.__get__ +types.FunctionType.__get__ +types.LambdaType.__get__ diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index a2440fdb9..e0f4e4496 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -428,13 +428,8 @@ re.Pattern.scanner # Undocumented and not useful. #6405 tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class # Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) -builtins.classmethod.__get__ -builtins.property.__get__ -builtins.staticmethod.__get__ types.ClassMethodDescriptorType.__get__ -types.FunctionType.__get__ types.GetSetDescriptorType.__get__ -types.LambdaType.__get__ types.MemberDescriptorType.__get__ types.MethodDescriptorType.__get__ types.WrapperDescriptorType.__get__