Skip to content

Commit 585517b

Browse files
stubtest: put all the incorrect __get__ sigs together (#7899)
1 parent d54d018 commit 585517b

File tree

6 files changed

+31
-21
lines changed

6 files changed

+31
-21
lines changed

tests/stubtest_allowlists/py310.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ re.Pattern.scanner # Undocumented and not useful. #6405
3535
symtable.SymbolTable.has_exec
3636
sys.UnraisableHookArgs # Not exported from sys
3737
tkinter.Tk.split
38-
types.ClassMethodDescriptorType.__get__
3938
types.GenericAlias.__getattr__
4039
types.GenericAlias.__mro_entries__
4140
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
42-
types.MethodDescriptorType.__get__
43-
types.WrapperDescriptorType.__get__
4441
typing._SpecialForm.__mro_entries__
4542
typing.ForwardRef._evaluate
4643
typing._SpecialForm.__init__
@@ -191,3 +188,8 @@ tkinter.EventType.__new__
191188
# White lies around defaults
192189
dataclasses.field
193190
dataclasses.KW_ONLY
191+
192+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
193+
types.ClassMethodDescriptorType.__get__
194+
types.MethodDescriptorType.__get__
195+
types.WrapperDescriptorType.__get__

tests/stubtest_allowlists/py311.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,10 @@ symtable.SymbolTable.has_exec
8989
sys.UnraisableHookArgs # Not exported from sys
9090
sys.exception
9191
tkinter._VersionInfoType.__doc__
92-
types.ClassMethodDescriptorType.__get__
9392
types.CodeType.co_exceptiontable
9493
types.CodeType.co_qualname
9594
types.CoroutineType.cr_suspended
9695
types.GeneratorType.gi_suspended
97-
types.MethodDescriptorType.__get__
98-
types.WrapperDescriptorType.__get__
9996
typing.ForwardRef._evaluate
10097
typing.NewType.__call__
10198
typing.NewType.__mro_entries__
@@ -256,3 +253,8 @@ wsgiref.types.WSGIApplication
256253

257254
# Really it's mad about dict.get
258255
wsgiref.types.WSGIEnvironment.get
256+
257+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
258+
types.ClassMethodDescriptorType.__get__
259+
types.MethodDescriptorType.__get__
260+
types.WrapperDescriptorType.__get__

tests/stubtest_allowlists/py37.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ re.Pattern.scanner # Undocumented and not useful. #6405
4646
sched.Event.__doc__ # __slots__ is overridden
4747
ssl.PROTOCOL_SSLv3 # Depends on ssl compilation
4848
ssl.RAND_egd # Depends on openssl compilation
49-
types.ClassMethodDescriptorType.__get__
50-
types.MethodDescriptorType.__get__
51-
types.WrapperDescriptorType.__get__
5249
typing.NamedTuple._asdict
5350
typing.NamedTuple._make
5451
typing.NamedTuple._replace
@@ -175,3 +172,8 @@ xml.parsers.expat.XMLParserType.intern # does exist but stubtest can't see it (
175172

176173
# White lies around defaults
177174
dataclasses.field
175+
176+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
177+
types.ClassMethodDescriptorType.__get__
178+
types.MethodDescriptorType.__get__
179+
types.WrapperDescriptorType.__get__

tests/stubtest_allowlists/py38.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ sched.Event.__doc__ # __slots__ is overridden
5959
ssl.PROTOCOL_SSLv3 # Depends on ssl compilation
6060
ssl.RAND_egd # Depends on openssl compilation
6161
sys.UnraisableHookArgs # Not exported from sys
62-
types.ClassMethodDescriptorType.__get__
63-
types.MethodDescriptorType.__get__
64-
types.WrapperDescriptorType.__get__
6562
typing.NamedTuple.__new__
6663
typing.NamedTuple._asdict
6764
typing.NamedTuple._make
@@ -193,3 +190,8 @@ types.CodeType.replace # stubtest thinks default values are None but None doesn
193190

194191
# White lies around defaults
195192
dataclasses.field
193+
194+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
195+
types.ClassMethodDescriptorType.__get__
196+
types.MethodDescriptorType.__get__
197+
types.WrapperDescriptorType.__get__

tests/stubtest_allowlists/py39.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@ ssl.RAND_egd # Depends on openssl compilation
5959
symtable.SymbolTable.has_exec
6060
sys.UnraisableHookArgs # Not exported from sys
6161
tkinter.Tk.split
62-
types.ClassMethodDescriptorType.__get__
6362
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
6463
types.GenericAlias.__getattr__
6564
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
66-
types.MethodDescriptorType.__get__
67-
types.WrapperDescriptorType.__get__
6865
typing.ForwardRef._evaluate
6966
typing.SupportsAbs.__init__
7067
typing.SupportsBytes.__init__
@@ -193,3 +190,8 @@ os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all Pat
193190

194191
# White lies around defaults
195192
dataclasses.field
193+
194+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
195+
types.ClassMethodDescriptorType.__get__
196+
types.MethodDescriptorType.__get__
197+
types.WrapperDescriptorType.__get__

tests/stubtest_allowlists/py3_common.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,12 @@ asyncio.locks.Condition.locked
4747
asyncio.locks.Condition.release
4848
asyncio.proactor_events.BaseProactorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
4949
asyncio.selector_events.BaseSelectorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
50-
builtins.classmethod.__get__ # this function can accept no value for the type parameter.
5150
builtins.ellipsis # type is not exposed anywhere
5251
builtins.function
5352
builtins.memoryview.__contains__ # C type that implements __getitem__
5453
sqlite3.dbapi2.Binary.__contains__ # C type that implements __getitem__
5554
sqlite3.Binary.__contains__ # C type that implements __getitem__
5655
builtins.object.__init__ # default C signature is incorrect
57-
builtins.property.__get__ # this function can accept no value for the type parameter.
58-
builtins.staticmethod.__get__ # this function can accept no value for the type parameter.
5956
builtins.type.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
6057
bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set
6158
# The following CodecInfo properties are added in __new__
@@ -211,8 +208,6 @@ tkinter.Tk.report_callback_exception # A bit of a lie, since it's actually a me
211208
tkinter.Wm.wm_iconphoto # Default value of argument can't be used without runtime error
212209
tkinter.font.Font.__getitem__ # Argument name differs (doesn't matter for __dunder__ methods)
213210
traceback.TracebackException.from_exception # explicitly expanding arguments going into TracebackException __init__
214-
types.GetSetDescriptorType.__get__ # this function can accept no value for the type parameter.
215-
types.MemberDescriptorType.__get__ # this function can accept no value for the type parameter.
216211
types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
217212
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
218213
types.ModuleType.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
@@ -406,9 +401,14 @@ pickle.Pickler.memo # undocumented implementation detail, has different type in
406401
pickle.Unpickler.memo # undocumented implementation detail, has different type in C/Python implementations
407402
tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class
408403

409-
# stubtest incorrectly highlights the type argument as not having a default value.
404+
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
410405
types.FunctionType.__get__
411406
types.LambdaType.__get__
407+
builtins.classmethod.__get__
408+
builtins.property.__get__
409+
builtins.staticmethod.__get__
410+
types.GetSetDescriptorType.__get__
411+
types.MemberDescriptorType.__get__
412412

413413
# Various classes in typing aren't types at runtime. In addition, mypy thinks some special forms are tautologically defined.
414414
typing.[A-Z]\w+

0 commit comments

Comments
 (0)