Skip to content

Commit 91fd79c

Browse files
authored
Updates for Python 3.11.0b4 (#8288)
1 parent b922869 commit 91fd79c

File tree

9 files changed

+75
-14
lines changed

9 files changed

+75
-14
lines changed

stdlib/_winapi.pyi

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,24 @@ if sys.platform == "win32":
105105
WAIT_ABANDONED_0: Literal[128]
106106
WAIT_OBJECT_0: Literal[0]
107107
WAIT_TIMEOUT: Literal[258]
108+
109+
if sys.version_info >= (3, 11):
110+
LOCALE_NAME_INVARIANT: str
111+
LOCALE_NAME_MAX_LENGTH: int
112+
LOCALE_NAME_SYSTEM_DEFAULT: str
113+
LOCALE_NAME_USER_DEFAULT: str | None
114+
115+
LCMAP_FULLWIDTH: int
116+
LCMAP_HALFWIDTH: int
117+
LCMAP_HIRAGANA: int
118+
LCMAP_KATAKANA: int
119+
LCMAP_LINGUISTIC_CASING: int
120+
LCMAP_LOWERCASE: int
121+
LCMAP_SIMPLIFIED_CHINESE: int
122+
LCMAP_TITLECASE: int
123+
LCMAP_TRADITIONAL_CHINESE: int
124+
LCMAP_UPPERCASE: int
125+
108126
def CloseHandle(__handle: int) -> None: ...
109127
@overload
110128
def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ...
@@ -163,6 +181,9 @@ if sys.platform == "win32":
163181
def GetVersion() -> int: ...
164182
def OpenProcess(__desired_access: int, __inherit_handle: bool, __process_id: int) -> int: ...
165183
def PeekNamedPipe(__handle: int, __size: int = ...) -> tuple[int, int] | tuple[bytes, int, int]: ...
184+
if sys.version_info >= (3, 11):
185+
def LCMapStringEx(locale: str, flags: int, src: str) -> str: ...
186+
166187
@overload
167188
def ReadFile(handle: int, size: int, overlapped: Literal[True]) -> tuple[Overlapped, int]: ...
168189
@overload

stdlib/sqlite3/dbapi2.pyi

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,14 @@ def enable_callback_tracebacks(__enable: bool) -> None: ...
217217

218218
# takes a pos-or-keyword argument because there is a C wrapper
219219
def enable_shared_cache(enable: int) -> None: ...
220-
def register_adapter(__type: type[_T], __caster: _Adapter[_T]) -> None: ...
221-
def register_converter(__name: str, __converter: _Converter) -> None: ...
220+
221+
if sys.version_info >= (3, 11):
222+
def register_adapter(__type: type[_T], __adapter: _Adapter[_T]) -> None: ...
223+
def register_converter(__typename: str, __converter: _Converter) -> None: ...
224+
225+
else:
226+
def register_adapter(__type: type[_T], __caster: _Adapter[_T]) -> None: ...
227+
def register_converter(__name: str, __converter: _Converter) -> None: ...
222228

223229
if sys.version_info < (3, 8):
224230
class Cache:

stdlib/typing.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
22
import sys
3-
from _typeshed import IdentityFunction, ReadableBuffer, Self as TypeshedSelf, SupportsKeysAndGetItem
3+
from _typeshed import IdentityFunction, Incomplete, ReadableBuffer, Self as TypeshedSelf, SupportsKeysAndGetItem
44
from abc import ABCMeta, abstractmethod
55
from types import (
66
BuiltinFunctionType,
@@ -138,6 +138,8 @@ class TypeVar:
138138
if sys.version_info >= (3, 10):
139139
def __or__(self, right: Any) -> _SpecialForm: ...
140140
def __ror__(self, left: Any) -> _SpecialForm: ...
141+
if sys.version_info >= (3, 11):
142+
def __typing_subst__(self, arg: Incomplete) -> Incomplete: ...
141143

142144
# Used for an undocumented mypy feature. Does not exist at runtime.
143145
_promote = object()
@@ -192,6 +194,8 @@ if sys.version_info >= (3, 11):
192194
__name__: str
193195
def __init__(self, name: str) -> None: ...
194196
def __iter__(self) -> Any: ...
197+
def __typing_subst__(self, arg: Never) -> Never: ...
198+
def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ...
195199

196200
if sys.version_info >= (3, 10):
197201
class ParamSpecArgs:
@@ -212,6 +216,10 @@ if sys.version_info >= (3, 10):
212216
def args(self) -> ParamSpecArgs: ...
213217
@property
214218
def kwargs(self) -> ParamSpecKwargs: ...
219+
if sys.version_info >= (3, 11):
220+
def __typing_subst__(self, arg: Incomplete) -> Incomplete: ...
221+
def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ...
222+
215223
def __or__(self, right: Any) -> _SpecialForm: ...
216224
def __ror__(self, left: Any) -> _SpecialForm: ...
217225
Concatenate: _SpecialForm

tests/stubtest_allowlists/py310.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,10 @@ ast.ImportFrom.level # None on the class, but never None on instances
168168

169169
# White lies around defaults
170170
dataclasses.KW_ONLY
171+
172+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
173+
builtins.classmethod.__get__
174+
builtins.property.__get__
175+
builtins.staticmethod.__get__
176+
types.FunctionType.__get__
177+
types.LambdaType.__get__

tests/stubtest_allowlists/py311.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ tkinter._VersionInfoType.__doc__
4646
typing.ForwardRef._evaluate
4747
typing.NewType.__call__
4848
typing.NewType.__mro_entries__
49-
typing.ParamSpec.__typing_subst__
50-
typing.TypeVar.__typing_subst__
51-
typing.TypeVarTuple.__typing_subst__
5249
weakref.WeakValueDictionary.update
5350

5451
# 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
153150
contextlib.AbstractAsyncContextManager.__class_getitem__
154151
contextlib.AbstractContextManager.__class_getitem__
155152

153+
# The argument to is_python_build() is deprecated since Python 3.11 and
154+
# has a default value of None to check for its existence and warn if it's
155+
# supplied. None is not supposed to be passed by user code and therefore
156+
# not included in the stubs.
157+
sysconfig.is_python_build
158+
156159
# Super-special typing primitives
157160
typing._SpecialForm.__mro_entries__
158161
typing._TypedDict.__delitem__
@@ -176,8 +179,8 @@ wsgiref.types.InputStream.readlines
176179
wsgiref.types.StartResponse.__call__
177180
wsgiref.types._Readable.read
178181

182+
# https://github.com/python/mypy/issues/13114
183+
wsgiref.types.WSGIEnvironment
184+
179185
# https://github.com/python/mypy/issues/12821 (stubtest bug with Callable type alias)
180186
wsgiref.types.WSGIApplication
181-
182-
# Really it's mad about dict.get
183-
wsgiref.types.WSGIEnvironment.get

tests/stubtest_allowlists/py37.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,10 @@ pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - funct
153153
xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args
154154
pyexpat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322)
155155
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)
156+
157+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
158+
builtins.classmethod.__get__
159+
builtins.property.__get__
160+
builtins.staticmethod.__get__
161+
types.FunctionType.__get__
162+
types.LambdaType.__get__

tests/stubtest_allowlists/py38.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,10 @@ queue.SimpleQueue.__init__
170170

171171
uuid.getnode # undocumented, unused parameter getters that was later removed
172172
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
173+
174+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
175+
builtins.classmethod.__get__
176+
builtins.property.__get__
177+
builtins.staticmethod.__get__
178+
types.FunctionType.__get__
179+
types.LambdaType.__get__

tests/stubtest_allowlists/py39.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,10 @@ ast.ImportFrom.level # None on the class, but never None on instances
169169

170170
ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154
171171
os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem
172+
173+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
174+
builtins.classmethod.__get__
175+
builtins.property.__get__
176+
builtins.staticmethod.__get__
177+
types.FunctionType.__get__
178+
types.LambdaType.__get__

tests/stubtest_allowlists/py3_common.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,8 @@ re.Pattern.scanner # Undocumented and not useful. #6405
428428
tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class
429429

430430
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
431-
builtins.classmethod.__get__
432-
builtins.property.__get__
433-
builtins.staticmethod.__get__
434431
types.ClassMethodDescriptorType.__get__
435-
types.FunctionType.__get__
436432
types.GetSetDescriptorType.__get__
437-
types.LambdaType.__get__
438433
types.MemberDescriptorType.__get__
439434
types.MethodDescriptorType.__get__
440435
types.WrapperDescriptorType.__get__

0 commit comments

Comments
 (0)