stubtest: run on py39 (#4110)

I've made mistakes in #4069 and #4010 that would have been caught by
this, so seems worth it to add now, and continue to remove from
whitelists.
Note that we run with --ignore-missing-stub in CI, so this whitelist
isn't all the changes we'd need to fully support Python 3.9

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-05-27 12:31:16 -07:00
committed by GitHub
parent 0c1babd288
commit 6575bd06bb
8 changed files with 289 additions and 84 deletions

View File

@@ -3,7 +3,7 @@
stubtest is a script in the mypy project that compares stubs to the actual objects at runtime.
Note that therefore the output of stubtest depends on which Python version it is run with.
In typeshed CI, we run stubtest with each Python minor version from 3.5 through 3.8 inclusive.
In typeshed CI, we run stubtest with each Python minor version from 3.5 through 3.9 inclusive.
We pin the version of mypy / stubtest we use in .travis.yml so changes to those don't break
typeshed CI.
@@ -35,7 +35,7 @@ def run_stubtest(typeshed_dir: Path) -> int:
"--whitelist",
str(whitelist_dir / version_whitelist),
]
if sys.version_info < (3, 8):
if sys.version_info < (3, 9):
# As discussed in https://github.com/python/typeshed/issues/3693, we only aim for
# positional-only arg accuracy for the latest Python version.
cmd += ["--ignore-positional-only"]
@@ -46,7 +46,7 @@ def run_stubtest(typeshed_dir: Path) -> int:
print(
"\nNB: stubtest output depends on the Python version (and system) it is run with. "
"See README.md for more details.\n"
"NB: We only check positional-only arg accuracy for Python 3.8.\n"
"NB: We only check positional-only arg accuracy for Python 3.9.\n"
"If stubtest is complaining about 'unused whitelist entry' after your fix, please "
"remove the entry from the whitelist file. Note you may have to do this for other "
"version-specific whitelists as well. Thanks for helping burn the backlog of errors!\n"

View File

@@ -42,10 +42,15 @@ json.loads
mmap.ACCESS_DEFAULT
multiprocessing.context.BaseContext.reducer
multiprocessing.shared_memory
nntplib._NNTPBase.starttls
os.DirEntry
os.utime
plistlib.Dict.__init__
pwd.getpwnam
pyexpat.XMLParserType.ExternalEntityParserCreate
site.getsitepackages
site.getuserbase
site.getusersitepackages
smtpd.SMTPChannel.__init__
smtpd.SMTPServer.__init__
socket.NETLINK_CRYPTO
@@ -62,6 +67,7 @@ typing.Generator.gi_frame
typing.Generator.gi_running
typing.Generator.gi_yieldfrom
typing.GenericMeta.__new__
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
typing.Mapping.get
typing.MutableMapping.pop
typing.MutableMapping.setdefault
@@ -73,11 +79,19 @@ typing.MutableSet.add
typing.MutableSet.discard
typing.MutableSet.remove
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing.Sequence.count
typing.Sequence.index
typing.runtime_checkable
unittest.async_case
unittest.case._AssertLogsContext.__init__
uuid.UUID.int
xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495
xml.etree.cElementTree.Element.__bool__
xml.etree.cElementTree.Element.copy
xml.etree.cElementTree.TreeBuilder.start # bpo-39495
xml.etree.cElementTree.XMLPullParser
xml.parsers.expat.XMLParserType.ExternalEntityParserCreate
zipfile.ZipFile.open

View File

@@ -37,10 +37,15 @@ json.loads
logging.handlers.MemoryHandler.__init__
mmap.ACCESS_DEFAULT
multiprocessing.shared_memory
nntplib._NNTPBase.starttls
os.utime
plistlib.Dict.__init__
pwd.getpwnam
pyexpat.XMLParserType.ExternalEntityParserCreate
secrets.SystemRandom.getstate
site.getsitepackages
site.getuserbase
site.getusersitepackages
smtplib.SMTP.sendmail
sre_compile.dis
ssl.SSLSocket.__init__
@@ -61,6 +66,7 @@ typing.Generator.gi_frame
typing.Generator.gi_running
typing.Generator.gi_yieldfrom
typing.GenericMeta.__new__
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
typing.Mapping.get
typing.MutableMapping.pop
typing.MutableMapping.setdefault
@@ -72,12 +78,20 @@ typing.MutableSet.add
typing.MutableSet.discard
typing.MutableSet.remove
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing.Sequence.count
typing.Sequence.index
typing.runtime_checkable
unittest.async_case
unittest.case._AssertLogsContext.__init__
urllib.parse.parse_qs
urllib.parse.parse_qsl
uuid.UUID.int
webbrowser.Opera.raise_opts
xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495
xml.etree.cElementTree.Element.__bool__
xml.etree.cElementTree.Element.copy
xml.etree.cElementTree.TreeBuilder.start # bpo-39495
xml.parsers.expat.XMLParserType.ExternalEntityParserCreate

View File

@@ -47,10 +47,15 @@ json.loads
logging.handlers.MemoryHandler.__init__
macurl2path
multiprocessing.shared_memory
nntplib._NNTPBase.starttls
os.utime
pwd.getpwnam
pyexpat.XMLParserType.ExternalEntityParserCreate
queue.SimpleQueue.__init__
secrets.SystemRandom.getstate
site.getsitepackages
site.getuserbase
site.getusersitepackages
smtplib.SMTP.sendmail
sre_constants.RANGE_IGNORE
time.CLOCK_PROF
@@ -60,14 +65,23 @@ tkinter.Misc.tk_menuBar
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing._SpecialForm.__init__
typing._SpecialForm.__new__
typing.runtime_checkable
unittest.async_case
unittest.case._AssertLogsContext.__init__
urllib.parse.parse_qs
urllib.parse.parse_qsl
uuid.UUID.int
uuid.UUID.is_safe
uuid.getnode # undocumented, unused parameter getters that was later removed
webbrowser.Opera.raise_opts
xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495
xml.etree.cElementTree.Element.__bool__
xml.etree.cElementTree.Element.copy
xml.etree.cElementTree.TreeBuilder.start # bpo-39495
xml.parsers.expat.XMLParserType.ExternalEntityParserCreate

View File

@@ -2,7 +2,6 @@ _thread.ExceptHookArgs
_thread._ExceptHookArgs
_tracemalloc._get_object_traceback
_tracemalloc.start
_weakref.getweakrefcount
ast.Bytes.__new__
ast.Ellipsis.__new__
ast.NameConstant.__new__
@@ -19,67 +18,36 @@ asyncio.events.TimerHandle.__init__
asyncio.futures.Future.__init__
asyncio.futures.Future._callbacks
asyncio.proactor_events._ProactorBasePipeTransport.__del__
bdb.Bdb.runcall
builtins.bytearray.extend
builtins.bytearray.pop
builtins.compile
builtins.dict.get
builtins.reversed
bz2.BZ2Compressor.compress
bz2.BZ2File.read
bz2.BZ2File.read1
bz2.BZ2File.readline
bz2.BZ2File.seek
cProfile.Profile.runcall
codecs.lookup
codecs.lookup_error
codecs.register
collections.AsyncGenerator.ag_await
collections.AsyncGenerator.ag_code
collections.AsyncGenerator.ag_frame
collections.AsyncGenerator.ag_running
collections.Container.__contains__
collections.ItemsView.__reversed__
collections.KeysView.__reversed__
collections.OrderedDict.fromkeys
collections.OrderedDict.setdefault
collections.ValuesView.__reversed__
collections.abc.AsyncGenerator.ag_await
collections.abc.AsyncGenerator.ag_code
collections.abc.AsyncGenerator.ag_frame
collections.abc.AsyncGenerator.ag_running
collections.abc.Container.__contains__
collections.abc.ItemsView.__reversed__
collections.abc.KeysView.__reversed__
collections.abc.ValuesView.__reversed__
concurrent.futures.Executor.submit
concurrent.futures.ProcessPoolExecutor.map
concurrent.futures.ProcessPoolExecutor.submit
concurrent.futures.ThreadPoolExecutor.submit
concurrent.futures._base.Executor.submit
concurrent.futures.process.ProcessPoolExecutor.submit
concurrent.futures.thread.ThreadPoolExecutor.submit
contextlib.AbstractContextManager.__exit__
contextlib.AsyncExitStack.callback
contextlib.AsyncExitStack.push_async_callback
contextlib.ExitStack.callback
contextvars.Context.__init__
contextvars.Context.get
contextvars.ContextVar.reset
contextvars.ContextVar.set
copy.PyStringMap
dataclasses.Field.__init__
dataclasses.InitVar.__init__
dataclasses.dataclass
dataclasses.field
dataclasses.replace
email.message.MIMEPart.as_string
enum.Enum._generate_next_value_
functools.partialmethod.__get__
functools.singledispatchmethod.__call__ # A lie to reflect that the descriptor get returns a callable
gettext.install
gettext.translation
hmac.compare_digest
http.client.HTTPSConnection.__init__
http.cookiejar.DefaultCookiePolicy.__init__
http.server.SimpleHTTPRequestHandler.__init__
@@ -87,15 +55,11 @@ importlib.metadata.EntryPointBase
inspect.isasyncgenfunction
inspect.iscoroutinefunction
inspect.isgeneratorfunction
io.IncrementalNewlineDecoder.setstate
ipaddress.IPv4Interface.hostmask
ipaddress.IPv6Interface.hostmask
ipaddress._BaseNetwork.broadcast_address
ipaddress._BaseNetwork.hostmask
itertools.tee
logging.handlers.MemoryHandler.__init__
lzma.LZMACompressor.compress
lzma.is_check_supported
macpath
macurl2path
mmap.MADV_[A-Z_]+
@@ -104,33 +68,16 @@ multiprocessing.pool.CLOSE
multiprocessing.pool.RUN
multiprocessing.pool.TERMINATE
multiprocessing.spawn._main
nntplib._NNTPBase.starttls
os.MFD_HUGE_32MB
os.MFD_HUGE_512MB
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
pickle.Pickler.dump
pickle.Pickler.reducer_override
platform.DEV_NULL
profile.Profile.runcall
pwd.getpwuid
queue.SimpleQueue.__init__
random.Random.getrandbits
random.getrandbits
secrets.SystemRandom.getstate
secrets.compare_digest
signal.sigtimedwait
signal.sigwaitinfo
site.getsitepackages
site.getuserbase
site.getusersitepackages
smtplib.SMTP.sendmail
sre_constants.RANGE_IGNORE
sys.UnraisableHookArgs
@@ -139,12 +86,15 @@ time.CLOCK_PROF
time.CLOCK_UPTIME
tkinter.Menu.tk_bindForTraversal
tkinter.Misc.tk_menuBar
trace.Trace.runfunc
types.ClassMethodDescriptorType.__get__
types.CodeType.replace
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing.SupportsAbs.__init__
typing.SupportsBytes.__init__
typing.SupportsComplex.__init__
@@ -154,15 +104,16 @@ typing.SupportsInt.__init__
typing.SupportsRound.__init__
typing._SpecialForm.__init__
typing._SpecialForm.__new__
unittest.TestCase.addCleanup
unittest.case.TestCase.addCleanup
unittest.case._AssertLogsContext.__init__
unittest.doModuleCleanups
uuid.getnode # undocumented, unused parameter getters that was later removed
weakref.WeakValueDictionary.__init__
weakref.WeakValueDictionary.update
weakref.getweakrefcount
webbrowser.Opera.raise_opts
xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495
xml.etree.ElementTree.XMLParser.__init__
xml.etree.cElementTree.Element.__bool__
xml.etree.cElementTree.Element.copy
xml.etree.cElementTree.TreeBuilder.start # bpo-39495
xml.etree.cElementTree.XMLParser.__init__
zipfile.Path.open
zipfile.ZipExtFile.seek

View File

@@ -0,0 +1,227 @@
_ast.ImportFrom.level
_dummy_thread
_thread.ExceptHookArgs
_thread._ExceptHookArgs
_tracemalloc._get_object_traceback
_tracemalloc.start
_weakref.getweakrefcount
aifc.openfp
array.array.fromstring
array.array.tostring
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.AbstractEventLoop.sock_sendfile
asyncio.Future.__init__
asyncio.Future._callbacks
asyncio.Future.cancel
asyncio.Handle.__init__
asyncio.Task.cancel
asyncio.TimerHandle.__init__
asyncio.events.AbstractEventLoop.sock_sendfile
asyncio.events.Handle.__init__
asyncio.events.TimerHandle.__init__
asyncio.futures.Future.__init__
asyncio.futures.Future._callbacks
asyncio.futures.Future.cancel
asyncio.proactor_events._ProactorBasePipeTransport.__del__
asyncio.tasks.Task.cancel
bdb.Bdb.runcall
builtins.bytearray.extend
builtins.bytearray.pop
builtins.compile
builtins.dict.get
builtins.reversed
bz2.BZ2Compressor.compress
bz2.BZ2File.read
bz2.BZ2File.read1
bz2.BZ2File.readline
bz2.BZ2File.seek
cProfile.Profile.runcall
codecs.lookup
codecs.lookup_error
codecs.register
collections.AsyncGenerator.ag_await
collections.AsyncGenerator.ag_code
collections.AsyncGenerator.ag_frame
collections.AsyncGenerator.ag_running
collections.Container.__contains__
collections.ItemsView.__reversed__
collections.KeysView.__reversed__
collections.OrderedDict.fromkeys
collections.OrderedDict.setdefault
collections.ValuesView.__reversed__
collections.abc.AsyncGenerator.ag_await
collections.abc.AsyncGenerator.ag_code
collections.abc.AsyncGenerator.ag_frame
collections.abc.AsyncGenerator.ag_running
collections.abc.Container.__contains__
collections.abc.ItemsView.__reversed__
collections.abc.KeysView.__reversed__
collections.abc.ValuesView.__reversed__
compileall.compile_dir
compileall.compile_file
concurrent.futures.Executor.submit
concurrent.futures.ProcessPoolExecutor.map
concurrent.futures.ProcessPoolExecutor.shutdown
concurrent.futures.ProcessPoolExecutor.submit
concurrent.futures.ThreadPoolExecutor.shutdown
concurrent.futures.ThreadPoolExecutor.submit
concurrent.futures._base.Executor.submit
concurrent.futures.process.ProcessPoolExecutor.shutdown
concurrent.futures.process.ProcessPoolExecutor.submit
concurrent.futures.thread.ThreadPoolExecutor.shutdown
concurrent.futures.thread.ThreadPoolExecutor.submit
contextlib.AbstractContextManager.__exit__
contextlib.AsyncExitStack.callback
contextlib.AsyncExitStack.push_async_callback
contextlib.ExitStack.callback
contextvars.Context.__init__
contextvars.Context.get
contextvars.ContextVar.reset
contextvars.ContextVar.set
copy.PyStringMap
dataclasses.Field.__init__
dataclasses.InitVar.__init__
dataclasses.dataclass
dataclasses.field
dataclasses.replace
dummy_threading
email.message.MIMEPart.as_string
enum.Enum._generate_next_value_
ftplib.FTP.__init__
ftplib.FTP_TLS.__init__
functools.partialmethod.__get__
functools.singledispatchmethod.__call__
gettext.install
gettext.translation
hmac.compare_digest
http.client.HTTPSConnection.__init__
http.cookiejar.DefaultCookiePolicy.__init__
http.server.SimpleHTTPRequestHandler.__init__
imaplib.IMAP4.__init__
imaplib.IMAP4.open
imaplib.IMAP4_SSL.__init__
imaplib.IMAP4_SSL.open
importlib.metadata.DistributionFinder.Context.pattern
importlib.metadata.EntryPointBase
inspect.isasyncgenfunction
inspect.iscoroutinefunction
inspect.isgeneratorfunction
io.IncrementalNewlineDecoder.setstate
ipaddress.IPv4Interface.hostmask
ipaddress.IPv6Interface.hostmask
ipaddress._BaseNetwork.broadcast_address
ipaddress._BaseNetwork.hostmask
itertools.tee
logging.FileHandler.__init__
logging.handlers.BaseRotatingHandler.__init__
logging.handlers.MemoryHandler.__init__
logging.handlers.RotatingFileHandler.__init__
logging.handlers.TimedRotatingFileHandler.__init__
logging.handlers.WatchedFileHandler.__init__
lzma.LZMACompressor.compress
lzma.is_check_supported
macpath
macurl2path
mmap.MADV_AUTOSYNC
mmap.MADV_CORE
mmap.MADV_NOCORE
mmap.MADV_NOSYNC
mmap.MADV_PROTECT
mmap.MADV_SOFT_OFFLINE
multiprocessing.managers.SharedMemoryServer.__init__
multiprocessing.pool.CLOSE
multiprocessing.pool.RUN
multiprocessing.pool.TERMINATE
multiprocessing.spawn._main
nntplib.NNTP.starttls
os.MFD_HUGE_32MB
os.MFD_HUGE_512MB
os.getgrouplist
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.sendfile
os.setresgid
os.setresuid
os.waitid
pickle.Pickler.dump
pickle.Pickler.reducer_override
pickle.loads
platform.DEV_NULL
platform.uname_result.__new__
platform.uname_result._fields
platform.uname_result.processor
profile.Profile.runcall
pwd.getpwnam
pwd.getpwuid
queue.SimpleQueue.__init__
random.Random.getrandbits
random.Random.sample
random.getrandbits
random.sample
secrets.SystemRandom.getstate
secrets.compare_digest
signal.sigtimedwait
signal.sigwaitinfo
smtplib.LMTP.__init__
smtplib.SMTP.sendmail
sre_constants.RANGE_IGNORE
ssl.AF_INET
symtable.SymbolTable.has_exec
sys.UnraisableHookArgs
threading.ExceptHookArgs
time.CLOCK_PROF
time.CLOCK_UPTIME
tkinter.Menu.tk_bindForTraversal
tkinter.Misc.tk_menuBar
trace.Trace.runfunc
types.ClassMethodDescriptorType.__get__
types.CodeType.replace
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
typing.Annotated
typing.NamedTuple
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.copy
typing._TypedDict.items
typing._TypedDict.keys
typing._TypedDict.pop
typing._TypedDict.setdefault
typing._TypedDict.update
typing._TypedDict.values
unittest.TestCase.addCleanup
unittest.case.TestCase.addCleanup
unittest.doModuleCleanups
weakref.WeakValueDictionary.__init__
weakref.WeakValueDictionary.update
weakref.getweakrefcount
webbrowser.Opera.raise_opts
xml.etree.ElementTree.Element.getchildren
xml.etree.ElementTree.Element.getiterator
xml.etree.ElementTree.ElementTree.getiterator
xml.etree.ElementTree.XMLParser.__init__
xml.etree.cElementTree
zipfile.ZipExtFile.seek

View File

@@ -379,7 +379,6 @@ multiprocessing.synchronize.SemLock.acquire
multiprocessing.synchronize.SemLock.release
netrc.NetrcParseError.__init__
netrc.netrc.__init__
nntplib._NNTPBase.starttls
ntpath.join
ntpath.realpath
numbers.Number.__hash__
@@ -408,7 +407,6 @@ pipes.Template.copy
pkgutil.ImpImporter.__init__
poplib.POP3_SSL.stls
posix.EX_NOTFOUND
pwd.getpwnam
pydoc.HTMLDoc.docdata
pydoc.HTMLDoc.docproperty
pydoc.HTMLDoc.docroutine
@@ -435,9 +433,6 @@ shlex.shlex.sourcehook
shutil.register_unpack_format
signal.SIGEMT
signal.SIGINFO
site.getsitepackages
site.getuserbase
site.getusersitepackages
smtpd.MailmanProxy.process_message
smtpd.PureProxy.process_message
smtplib.SMTP.send_message
@@ -513,10 +508,6 @@ types.prepare_class
typing.AwaitableGenerator
typing.IO.__iter__
typing.IO.__next__
typing.IO.closed
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing.type_check_only
unittest.TestCase.assertAlmostEqual
unittest.TestCase.assertDictContainsSubset
@@ -532,7 +523,6 @@ unittest.case.TestCase.assertAlmostEqual
unittest.case.TestCase.assertDictContainsSubset
unittest.case.TestCase.assertNotAlmostEqual
unittest.case.TestCase.assertSequenceEqual
unittest.case._AssertLogsContext.__init__
unittest.case.expectedFailure
unittest.expectedFailure
unittest.loader.TestLoader.loadTestsFromModule
@@ -578,10 +568,6 @@ wsgiref.util.FileWrapper.close
xml.etree.ElementPath._SelectorContext.parent_map
xml.etree.ElementTree.Element.__bool__
xml.etree.ElementTree.Element.copy
xml.etree.ElementTree.TreeBuilder.start
xml.etree.cElementTree.Element.__bool__
xml.etree.cElementTree.Element.copy
xml.etree.cElementTree.TreeBuilder.start
xml.sax.xmlreader.AttributesImpl.has_key
zipfile.ZipExtFile.read
zipfile.ZipExtFile.readline