From 9c86ca9653bf2eff9e5b60a24e8f635a4be90f7b Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 20 May 2022 08:43:08 -0700 Subject: [PATCH] stubtest: put all the incorrect __get__ sigs together --- tests/stubtest_allowlists/py310.txt | 8 +++++--- tests/stubtest_allowlists/py311.txt | 8 +++++--- tests/stubtest_allowlists/py37.txt | 8 +++++--- tests/stubtest_allowlists/py38.txt | 8 +++++--- tests/stubtest_allowlists/py39.txt | 8 +++++--- tests/stubtest_allowlists/py3_common.txt | 12 ++++++------ 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 20e5cd202faf..1a2034f8b400 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -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__ @@ -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__ diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index a42ea8c5b8a5..8b170553e1b3 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -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__ @@ -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__ diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index f73afbe065c0..53ebc148455d 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -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 @@ -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__ diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 3d4c0d6e7e2b..947cd504e7f8 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -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 @@ -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__ diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index 248874679f5b..162ec03d9a35 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -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__ @@ -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__ diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index 50765fff1174..2521c2f698e5 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -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__ @@ -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. @@ -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+