diff --git a/.github/workflows/stubtest-unused-whitelist.yml b/.github/workflows/stubtest-unused-whitelist.yml index 403df166a..f4fd9477b 100644 --- a/.github/workflows/stubtest-unused-whitelist.yml +++ b/.github/workflows/stubtest-unused-whitelist.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "windows-latest"] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9, '3.10.0-beta.1'] fail-fast: false steps: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 742f0b5f0..38184915f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -111,7 +111,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "windows-latest"] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9, '3.10.0-beta.1'] fail-fast: false steps: diff --git a/tests/stubtest_whitelists/linux-py310.txt b/tests/stubtest_whitelists/linux-py310.txt new file mode 100644 index 000000000..86931b343 --- /dev/null +++ b/tests/stubtest_whitelists/linux-py310.txt @@ -0,0 +1,3 @@ +dbm.ndbm +locale.nl_langinfo +posixpath.realpath diff --git a/tests/stubtest_whitelists/py310.txt b/tests/stubtest_whitelists/py310.txt new file mode 100644 index 000000000..4a43e760d --- /dev/null +++ b/tests/stubtest_whitelists/py310.txt @@ -0,0 +1,230 @@ +_ast.ImportFrom.level +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running +_collections_abc.AsyncGenerator.asend +_collections_abc.AsyncGenerator.athrow +_collections_abc.Container.__contains__ +_collections_abc.Coroutine.send +_collections_abc.Coroutine.throw +_collections_abc.Generator.send +_collections_abc.Generator.throw +_collections_abc.ItemsView.__reversed__ +_collections_abc.KeysView.__reversed__ +_collections_abc.ValuesView.__reversed__ +# This was changed in Python 3.9.2. +_curses.color_pair +_dummy_thread +ast.Bytes.__new__ +ast.Ellipsis.__new__ +ast.ExtSlice.__new__ +ast.ImportFrom.level +ast.Index.__new__ +ast.NameConstant.__new__ +ast.Num.__new__ +ast.Str.__new__ +asyncio.compat # module removed in 3.7 +asyncio.Future.__init__ # Usually initialized from c object +asyncio.Future._callbacks # Usually initialized from c object +asyncio.futures.Future.__init__ # Usually initialized from c object +asyncio.futures.Future._callbacks # Usually initialized from c object +builtins.dict.get +collections.abc.AsyncGenerator.ag_await +collections.abc.AsyncGenerator.ag_code +collections.abc.AsyncGenerator.ag_frame +collections.abc.AsyncGenerator.ag_running +collections.abc.ItemsView.__reversed__ +collections.abc.KeysView.__reversed__ +collections.abc.ValuesView.__reversed__ +contextlib.nullcontext # not a function at runtime +contextvars.Context.__init__ +contextvars.Context.get +copy.PyStringMap +curses.color_pair +dataclasses.field +dummy_threading +enum.Enum._generate_next_value_ +fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve +ftplib.FTP.__init__ +ftplib.FTP_TLS.__init__ +functools.partialmethod.__get__ +functools.singledispatchmethod.__call__ +gettext.install +gettext.translation +hmac.new # Stub is a white lie; see comments in the stub +http.client.HTTPSConnection.__init__ +http.cookiejar.DefaultCookiePolicy.__init__ +http.server.SimpleHTTPRequestHandler.__init__ +importlib.abc.Traversable.__init__ # Inherits __init__ from typing.Protocol +ipaddress.IPv4Interface.hostmask +ipaddress.IPv6Interface.hostmask +ipaddress._BaseNetwork.broadcast_address +ipaddress._BaseNetwork.hostmask +logging.FileHandler.__init__ +logging.handlers.BaseRotatingHandler.__init__ +logging.handlers.RotatingFileHandler.__init__ +logging.handlers.TimedRotatingFileHandler.__init__ +logging.handlers.WatchedFileHandler.__init__ +macpath # module removed in 3.8 +macurl2path # module removed in 3.7 +mmap.MADV_[A-Z_]+ # platform dependent constants +multiprocessing.spawn._main +nntplib.NNTP.starttls +os.getgrouplist +os.sendfile +pickle.Pickler.reducer_override +# platform.uname_result's processor field is now dynamically made to exist +platform.uname_result.__new__ +platform.uname_result._fields +platform.uname_result.processor +queue.SimpleQueue.__init__ +select.epoll.register +smtplib.LMTP.__init__ +smtplib.SMTP.sendmail +sre_constants.RANGE_IGNORE +ssl.PROTOCOL_SSLv3 # Depends on ssl compilation +ssl.RAND_egd # Depends on openssl compilation +symtable.SymbolTable.has_exec +sys.UnraisableHookArgs # Not exported from sys +time.CLOCK_PROF +time.CLOCK_UPTIME +types.ClassMethodDescriptorType.__get__ +types.CodeType.replace +types.GenericAlias.__getattr__ +types.MethodDescriptorType.__get__ +types.WrapperDescriptorType.__get__ +typing.ForwardRef._evaluate +typing.SupportsAbs.__init__ +typing.SupportsBytes.__init__ +typing.SupportsComplex.__init__ +typing.SupportsFloat.__init__ +typing.SupportsIndex.__init__ +typing.SupportsInt.__init__ +typing.SupportsRound.__init__ +typing._SpecialForm.__init__ +typing._TypedDict.__delitem__ +typing._TypedDict.__ior__ +typing._TypedDict.__or__ +typing._TypedDict.copy +typing._TypedDict.items +typing._TypedDict.keys +typing._TypedDict.pop +typing._TypedDict.setdefault +typing._TypedDict.update +typing._TypedDict.values +weakref.WeakValueDictionary.update +webbrowser.Opera.raise_opts +xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature +xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature + +# positional-only complaints +builtins.bytearray.pop +builtins.bytearray.remove +collections.OrderedDict.fromkeys +collections.OrderedDict.setdefault +collections.abc.AsyncGenerator.asend +collections.abc.AsyncGenerator.athrow +collections.abc.Container.__contains__ +collections.abc.Coroutine.send +collections.abc.Coroutine.throw +collections.abc.Generator.send +collections.abc.Generator.throw +contextlib.AsyncExitStack.callback +contextlib.AsyncExitStack.push_async_callback +contextlib.ExitStack.callback +contextvars.ContextVar.reset +contextvars.ContextVar.set +io.IncrementalNewlineDecoder.setstate +os.initgroups +os.pipe2 +os.posix_fadvise +os.posix_fallocate +os.sched_getaffinity +os.sched_getparam +os.sched_getscheduler +os.sched_rr_get_interval +os.sched_setaffinity +os.sched_setparam +os.sched_setscheduler +os.setresgid +os.setresuid +os.waitid +pwd.getpwnam +pwd.getpwuid +random.SystemRandom.getrandbits +secrets.SystemRandom.getrandbits +signal.sigtimedwait +signal.sigwaitinfo +trace.Trace.runfunc +zipfile.ZipExtFile.seek +# These enums derive from (str, Enum). See comment in py3_common.txt +pstats.SortKey.__new__ +tkinter.EventType.__new__ + +# Rest of these errors are new in Python 3.10: +_bootlocale +_markupbase.ParserBase.error +asyncio.proactor_events._ProactorReadPipeTransport.__init__ +builtins.aiter +dataclasses.Field.__init__ +dataclasses.dataclass +dataclasses.make_dataclass +distutils.command.bdist_wininst +fileinput.FileInput.__init__ +fileinput.hook_compressed +fileinput.input +formatter +importlib.abc.ResourceReader.is_resource +importlib.machinery.BuiltinImporter.create_module +importlib.machinery.BuiltinImporter.exec_module +importlib.machinery.FrozenImporter.create_module +importlib.machinery.PathFinder.invalidate_caches +importlib.metadata.MetadataPathFinder.invalidate_caches +locale.strcoll +locale.strxfrm +logging.Formatter.__init__ +logging.LoggerAdapter.__init__ +logging.PercentStyle.__init__ +logging.config.fileConfig +parser +pathlib.Path.chmod +pathlib.Path.stat +pathlib.Path.write_text +py_compile.main +pyclbr.Class.__init__ +pyclbr.Function.__init__ +sched.Event.__new__ +sched.Event._fields +signal.default_int_handler +sqlite3.Connection.interrupt +sqlite3.Connection.iterdump +sqlite3.Connection.rollback +sqlite3.Connection.set_authorizer +sqlite3.Connection.set_progress_handler +sqlite3.Connection.set_trace_callback +sqlite3.Cursor.close +sqlite3.Cursor.setinputsizes +sqlite3.Cursor.setoutputsize +sqlite3.Row.keys +sqlite3.complete_statement +sqlite3.dbapi2.Connection.interrupt +sqlite3.dbapi2.Connection.iterdump +sqlite3.dbapi2.Connection.rollback +sqlite3.dbapi2.Connection.set_authorizer +sqlite3.dbapi2.Connection.set_progress_handler +sqlite3.dbapi2.Connection.set_trace_callback +sqlite3.dbapi2.Cursor.close +sqlite3.dbapi2.Cursor.setinputsizes +sqlite3.dbapi2.Cursor.setoutputsize +sqlite3.dbapi2.Row.keys +sqlite3.dbapi2.complete_statement +ssl.SSLContext.__new__ +ssl._create_unverified_context +ssl.get_server_certificate +statistics.harmonic_mean +symbol +tempfile.TemporaryDirectory.__init__ +unicodedata.ucnhash_CAPI +unittest.mock.create_autospec +zipfile.Path.open diff --git a/tests/stubtest_whitelists/py36.txt b/tests/stubtest_whitelists/py36.txt index ce1b011eb..0f45e2d3d 100644 --- a/tests/stubtest_whitelists/py36.txt +++ b/tests/stubtest_whitelists/py36.txt @@ -80,3 +80,38 @@ ssl.Options.__new__ ssl.VerifyFlags.__new__ ssl.VerifyMode.__new__ tkinter.EventType.__new__ + +builtins.memoryview.__iter__ # C type that implements __getitem__ +builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only +collections.Coroutine.cr_await +collections.Coroutine.cr_code +collections.Coroutine.cr_frame +collections.Coroutine.cr_running +collections.Generator.gi_code +collections.Generator.gi_frame +collections.Generator.gi_running +collections.Generator.gi_yieldfrom +collections.Mapping.get # Adding None to the Union messed up mypy +collections.Sequence.index # Supporting None in end is not mandatory + +# The following methods were changed in point releases from Python 3.6 to 3.9 +# as part of a security fix. These excludes can be removed when the GitHub +# action workflow uses Python versions that include the fix (adding a +# separator argument). +cgi.FieldStorage.__init__ +cgi.parse +cgi.parse_multipart +urllib.parse.parse_qs +urllib.parse.parse_qsl + +# These enums derive from (int, IntEnum) or (str, Enum). Strangely, +# at runtime, they inherit Enum.__new__, not int.__new__ or +# str.__new__ as the mro would dictate, which is why stubtest balks. +enum.IntEnum.__new__ +http.HTTPStatus.__new__ +inspect._ParameterKind.__new__ +signal.Handlers.__new__ +signal.Sigmasks.__new__ +signal.Signals.__new__ +socket.AddressFamily.__new__ +socket.SocketKind.__new__ diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index e47b5ff4b..7f154e7e8 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -83,3 +83,38 @@ ssl.TLSVersion.__new__ ssl.VerifyFlags.__new__ ssl.VerifyMode.__new__ tkinter.EventType.__new__ + +builtins.memoryview.__iter__ # C type that implements __getitem__ +builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only +collections.Coroutine.cr_await +collections.Coroutine.cr_code +collections.Coroutine.cr_frame +collections.Coroutine.cr_running +collections.Generator.gi_code +collections.Generator.gi_frame +collections.Generator.gi_running +collections.Generator.gi_yieldfrom +collections.Mapping.get # Adding None to the Union messed up mypy +collections.Sequence.index # Supporting None in end is not mandatory + +# The following methods were changed in point releases from Python 3.6 to 3.9 +# as part of a security fix. These excludes can be removed when the GitHub +# action workflow uses Python versions that include the fix (adding a +# separator argument). +cgi.FieldStorage.__init__ +cgi.parse +cgi.parse_multipart +urllib.parse.parse_qs +urllib.parse.parse_qsl + +# These enums derive from (int, IntEnum) or (str, Enum). Strangely, +# at runtime, they inherit Enum.__new__, not int.__new__ or +# str.__new__ as the mro would dictate, which is why stubtest balks. +enum.IntEnum.__new__ +http.HTTPStatus.__new__ +inspect._ParameterKind.__new__ +signal.Handlers.__new__ +signal.Sigmasks.__new__ +signal.Signals.__new__ +socket.AddressFamily.__new__ +socket.SocketKind.__new__ diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index 6dea6ae2a..370f32cdd 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -113,3 +113,38 @@ ssl.TLSVersion.__new__ ssl.VerifyFlags.__new__ ssl.VerifyMode.__new__ tkinter.EventType.__new__ + +builtins.memoryview.__iter__ # C type that implements __getitem__ +builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only +collections.Coroutine.cr_await +collections.Coroutine.cr_code +collections.Coroutine.cr_frame +collections.Coroutine.cr_running +collections.Generator.gi_code +collections.Generator.gi_frame +collections.Generator.gi_running +collections.Generator.gi_yieldfrom +collections.Mapping.get # Adding None to the Union messed up mypy +collections.Sequence.index # Supporting None in end is not mandatory + +# The following methods were changed in point releases from Python 3.6 to 3.9 +# as part of a security fix. These excludes can be removed when the GitHub +# action workflow uses Python versions that include the fix (adding a +# separator argument). +cgi.FieldStorage.__init__ +cgi.parse +cgi.parse_multipart +urllib.parse.parse_qs +urllib.parse.parse_qsl + +# These enums derive from (int, IntEnum) or (str, Enum). Strangely, +# at runtime, they inherit Enum.__new__, not int.__new__ or +# str.__new__ as the mro would dictate, which is why stubtest balks. +enum.IntEnum.__new__ +http.HTTPStatus.__new__ +inspect._ParameterKind.__new__ +signal.Handlers.__new__ +signal.Sigmasks.__new__ +signal.Signals.__new__ +socket.AddressFamily.__new__ +socket.SocketKind.__new__ diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index 0b5afd0de..50449383c 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -192,3 +192,38 @@ ssl.TLSVersion.__new__ ssl.VerifyFlags.__new__ ssl.VerifyMode.__new__ tkinter.EventType.__new__ + +builtins.memoryview.__iter__ # C type that implements __getitem__ +builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only +collections.Coroutine.cr_await +collections.Coroutine.cr_code +collections.Coroutine.cr_frame +collections.Coroutine.cr_running +collections.Generator.gi_code +collections.Generator.gi_frame +collections.Generator.gi_running +collections.Generator.gi_yieldfrom +collections.Mapping.get # Adding None to the Union messed up mypy +collections.Sequence.index # Supporting None in end is not mandatory + +# The following methods were changed in point releases from Python 3.6 to 3.9 +# as part of a security fix. These excludes can be removed when the GitHub +# action workflow uses Python versions that include the fix (adding a +# separator argument). +cgi.FieldStorage.__init__ +cgi.parse +cgi.parse_multipart +urllib.parse.parse_qs +urllib.parse.parse_qsl + +# These enums derive from (int, IntEnum) or (str, Enum). Strangely, +# at runtime, they inherit Enum.__new__, not int.__new__ or +# str.__new__ as the mro would dictate, which is why stubtest balks. +enum.IntEnum.__new__ +http.HTTPStatus.__new__ +inspect._ParameterKind.__new__ +signal.Handlers.__new__ +signal.Sigmasks.__new__ +signal.Signals.__new__ +socket.AddressFamily.__new__ +socket.SocketKind.__new__ diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index a81a9c1a1..1759fb240 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -38,19 +38,10 @@ builtins.classmethod.__get__ # this function can accept no value for the type p builtins.ellipsis # type is not exposed anywhere builtins.function builtins.memoryview.__contains__ # C type that implements __getitem__ -builtins.memoryview.__iter__ # C type that implements __getitem__ -builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only 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. bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set -# The following methods were changed in point releases from Python 3.6 to 3.9 -# as part of a security fix. These excludes can be removed when the GitHub -# action workflow uses Python versions that include the fix (adding a -# separator argument). -cgi.FieldStorage.__init__ -cgi.parse -cgi.parse_multipart # The following CodecInfo properties are added in __new__ codecs.CodecInfo.decode codecs.CodecInfo.encode @@ -61,16 +52,6 @@ codecs.CodecInfo.streamwriter collections.Callable # Some typecheckers need this as specialform # Coroutine and Generator properties are added programmatically collections.ChainMap.get # Adding None to the underlying Mapping Union messed up mypy -collections.Coroutine.cr_await -collections.Coroutine.cr_code -collections.Coroutine.cr_frame -collections.Coroutine.cr_running -collections.Generator.gi_code -collections.Generator.gi_frame -collections.Generator.gi_running -collections.Generator.gi_yieldfrom -collections.Mapping.get # Adding None to the Union messed up mypy -collections.Sequence.index # Supporting None in end is not mandatory # Coroutine and Generator properties are added programmatically collections.abc.Coroutine.cr_await collections.abc.Coroutine.cr_code @@ -227,12 +208,6 @@ typing.IO.__next__ # Added because IO streams are iterable. See https://github. typing.type_check_only # typing decorator that is not available at runtime unittest.mock.patch # It's a complicated overload and I haven't been able to figure out why stubtest doesn't like it urllib.parse._DefragResultBase.__new__ # Generic NamedTuple is problematic in mypy, so regular tuple was used. See https://github.com/python/mypy/issues/685 -# The following methods were changed in point releases from Python 3.6 to 3.9 -# as part of a security fix. These excludes can be removed when the GitHub -# action workflow uses Python versions that include the fix (adding a -# separator argument). -urllib.parse.parse_qs -urllib.parse.parse_qsl urllib.request.BaseHandler.http_error_nnn urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ urllib.robotparser.RobotFileParser.can_fetch @@ -250,18 +225,6 @@ webbrowser.UnixBrowser.remote_action_newtab webbrowser.UnixBrowser.remote_action_newwin wsgiref.types # Doesn't exist, see comments in file -# These enums derive from (int, IntEnum) or (str, Enum). Strangely, -# at runtime, they inherit Enum.__new__, not int.__new__ or -# str.__new__ as the mro would dictate, which is why stubtest balks. -enum.IntEnum.__new__ -http.HTTPStatus.__new__ -inspect._ParameterKind.__new__ -signal.Handlers.__new__ -signal.Sigmasks.__new__ -signal.Signals.__new__ -socket.AddressFamily.__new__ -socket.SocketKind.__new__ - # ========== # Whitelist entries that cannot or should not be fixed # ========== diff --git a/tests/stubtest_whitelists/win32-py310.txt b/tests/stubtest_whitelists/win32-py310.txt new file mode 100644 index 000000000..1505484b0 --- /dev/null +++ b/tests/stubtest_whitelists/win32-py310.txt @@ -0,0 +1,8 @@ +_msi.CreateRecord +_msi.FCICreate +_msi.OpenDatabase +ntpath.realpath +sqlite3.Connection.enable_load_extension +sqlite3.Connection.load_extension +sqlite3.dbapi2.Connection.enable_load_extension +sqlite3.dbapi2.Connection.load_extension