This makes these classes usable if type annotations are given as "IO"
or "TextIO". In the future, we'll then be able to move open() to
return a concrete class instead (#3951).
* compileall: add stripdir, prependdir and limit_sl_dest
* compileall: compile_dir's default value is now None
* compileall: update for current py39 (as of beta1)
Co-authored-by: hauntsaninja <>
* Allow unicode objects throughout urlparse.py
Functions such as `urlparse()`, if given a unicode object,
will happily return a ParseResult of unicode components.
Relatedly, functions like `unquote()` will accept any of
bytes/str/unicode and return an object of the same type
or a composite containing that type.
* Allow unicode in several places in Thread
`name` and `kwargs` to Thread.__init__ function perfectly
well with unicode, not just str.
Note: the .name attribute will always be str even
if the constructor is passed something else, since
__init__ calls:
self.__name = str(name or _newname())
* Use typing.AnyStr properly
...rather than defining a new TypeVar unncessarily.
* Use typing.Text properly
Text is behaviorally equivalent to Union[str, unicode]
for Python 2 argument types.
* Remove outdated import & definition
* [check file consistent] copy changes to _dummy_threading.pyi
- While this appears to be private, it's also documented as available
to set here: https://docs.python.org/3/howto/logging.html#optimization
- Did *not* update `logging.logThreads` et al to match the
documentation as it may be more appropriate to update the
documentation to set to `False` rather than to `0` based on how these
are used
Type further narrowed based on known type of a parameter to
`os.normcase`
There are a couple other py39 changes to be made in asyncio, but I'm
trying to avoid merge issues with whitelists / Windows for now.
Co-authored-by: hauntsaninja <>
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 <>