Skip to content

stubtest: put all the incorrect __get__ sigs together #7899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ re.Pattern.scanner # Undocumented and not useful. #6405
symtable.SymbolTable.has_exec
sys.UnraisableHookArgs # Not exported from sys
tkinter.Tk.split
types.ClassMethodDescriptorType.__get__
types.GenericAlias.__getattr__
types.GenericAlias.__mro_entries__
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing._SpecialForm.__mro_entries__
typing.ForwardRef._evaluate
typing._SpecialForm.__init__
Expand Down Expand Up @@ -191,3 +188,8 @@ tkinter.EventType.__new__
# White lies around defaults
dataclasses.field
dataclasses.KW_ONLY

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
8 changes: 5 additions & 3 deletions tests/stubtest_allowlists/py311.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,10 @@ symtable.SymbolTable.has_exec
sys.UnraisableHookArgs # Not exported from sys
sys.exception
tkinter._VersionInfoType.__doc__
types.ClassMethodDescriptorType.__get__
types.CodeType.co_exceptiontable
types.CodeType.co_qualname
types.CoroutineType.cr_suspended
types.GeneratorType.gi_suspended
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing.ForwardRef._evaluate
typing.NewType.__call__
typing.NewType.__mro_entries__
Expand Down Expand Up @@ -256,3 +253,8 @@ wsgiref.types.WSGIApplication

# Really it's mad about dict.get
wsgiref.types.WSGIEnvironment.get

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
8 changes: 5 additions & 3 deletions tests/stubtest_allowlists/py37.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ re.Pattern.scanner # Undocumented and not useful. #6405
sched.Event.__doc__ # __slots__ is overridden
ssl.PROTOCOL_SSLv3 # Depends on ssl compilation
ssl.RAND_egd # Depends on openssl compilation
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
Expand Down Expand Up @@ -175,3 +172,8 @@ xml.parsers.expat.XMLParserType.intern # does exist but stubtest can't see it (

# White lies around defaults
dataclasses.field

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
8 changes: 5 additions & 3 deletions tests/stubtest_allowlists/py38.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ sched.Event.__doc__ # __slots__ is overridden
ssl.PROTOCOL_SSLv3 # Depends on ssl compilation
ssl.RAND_egd # Depends on openssl compilation
sys.UnraisableHookArgs # Not exported from sys
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
Expand Down Expand Up @@ -193,3 +190,8 @@ types.CodeType.replace # stubtest thinks default values are None but None doesn

# White lies around defaults
dataclasses.field

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
8 changes: 5 additions & 3 deletions tests/stubtest_allowlists/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@ ssl.RAND_egd # Depends on openssl compilation
symtable.SymbolTable.has_exec
sys.UnraisableHookArgs # Not exported from sys
tkinter.Tk.split
types.ClassMethodDescriptorType.__get__
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
types.GenericAlias.__getattr__
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing.ForwardRef._evaluate
typing.SupportsAbs.__init__
typing.SupportsBytes.__init__
Expand Down Expand Up @@ -193,3 +190,8 @@ os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all Pat

# White lies around defaults
dataclasses.field

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
12 changes: 6 additions & 6 deletions tests/stubtest_allowlists/py3_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,12 @@ asyncio.locks.Condition.locked
asyncio.locks.Condition.release
asyncio.proactor_events.BaseProactorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
asyncio.selector_events.BaseSelectorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
builtins.classmethod.__get__ # this function can accept no value for the type parameter.
builtins.ellipsis # type is not exposed anywhere
builtins.function
builtins.memoryview.__contains__ # C type that implements __getitem__
sqlite3.dbapi2.Binary.__contains__ # C type that implements __getitem__
sqlite3.Binary.__contains__ # C type that implements __getitem__
builtins.object.__init__ # default C signature is incorrect
builtins.property.__get__ # this function can accept no value for the type parameter.
builtins.staticmethod.__get__ # this function can accept no value for the type parameter.
builtins.type.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set
# The following CodecInfo properties are added in __new__
Expand Down Expand Up @@ -211,8 +208,6 @@ tkinter.Tk.report_callback_exception # A bit of a lie, since it's actually a me
tkinter.Wm.wm_iconphoto # Default value of argument can't be used without runtime error
tkinter.font.Font.__getitem__ # Argument name differs (doesn't matter for __dunder__ methods)
traceback.TracebackException.from_exception # explicitly expanding arguments going into TracebackException __init__
types.GetSetDescriptorType.__get__ # this function can accept no value for the type parameter.
types.MemberDescriptorType.__get__ # this function can accept no value for the type parameter.
types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
types.ModuleType.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
Expand Down Expand Up @@ -406,9 +401,14 @@ pickle.Pickler.memo # undocumented implementation detail, has different type in
pickle.Unpickler.memo # undocumented implementation detail, has different type in C/Python implementations
tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class

# stubtest incorrectly highlights the type argument as not having a default value.
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.FunctionType.__get__
types.LambdaType.__get__
builtins.classmethod.__get__
builtins.property.__get__
builtins.staticmethod.__get__
types.GetSetDescriptorType.__get__
types.MemberDescriptorType.__get__

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