Changelog¶
Python 3.9.6 final¶
Release date: 2021-06-28
Security¶
bpo-44022: mod:
http.clientnow avoids infinitely reading potential HTTP headers after a100 Continuestatus response from the server.
Core and Builtins¶
bpo-44409: Fix error location information for tokenizer errors raised on initialization of the tokenizer. Patch by Pablo Galindo.
bpo-43667: Improve Unicode support in non-UTF locales on Oracle Solaris. This issue does not affect other Solaris systems.
bpo-44168: Fix error message in the parser involving keyword arguments with invalid expressions. Patch by Pablo Galindo
bpo-44114: Fix incorrect dictkeys_reversed and dictitems_reversed function signatures in C code, which broke webassembly builds.
bpo-44070: No longer eagerly makes import filenames absolute, except for extension modules, which was introduced in 3.9.5.
bpo-28146: Fix a confusing error message in
str.format().bpo-11105: When compiling
ast.ASTobjects with recursive references throughcompile(), the interpreter doesn’t crash anymore instead it raises aRecursionError.
Library¶
bpo-44516: Update vendored pip to 21.1.3
bpo-44482: Fix very unlikely resource leak in
globin alternate Python implementations.bpo-44439: Fix in
bz2.BZ2File.write()/lzma.LZMAFile.write()methods, when the input data is an object that supports the buffer protocol, the file length may be wrong.bpo-44434: _thread.start_new_thread() no longer calls PyThread_exit_thread() explicitly at the thread exit, the call was redundant. On Linux with the glibc, pthread_exit() aborts the whole process if dlopen() fails to open libgcc_s.so file (ex: EMFILE error). Patch by Victor Stinner.
bpo-44422: The
threading.enumerate()function now uses a reentrant lock to prevent a hang on reentrant call. Patch by Victor Stinner.bpo-44395: Fix
as_string()to pass unixfrom properly. Patch by Dong-hee Na.bpo-44342: [Enum] Be more robust in searching for pickle support before making an enum class unpicklable.
bpo-44356: [Enum] Allow multiple data-type mixins if they are all the same.
bpo-44254: On Mac, give turtledemo button text a color that works on both light or dark background. Programmers cannot control the latter.
bpo-44145:
hmaccomputations were not releasing the GIL while calling the OpenSSLHMAC_UpdateC API (a new feature in 3.9). This unintentionally prevented parallel computation as otherhashlibalgorithms support.bpo-37788: Fix a reference leak when a Thread object is never joined.
bpo-44061: Fix regression in previous release when calling
pkgutil.iter_modules()with a list ofpathlib.Pathobjectsbpo-36515: The
hashlibmodule no longer does unaligned memory accesses when compiled for ARM platforms.bpo-44018: random.seed() no longer mutates bytearray inputs.
bpo-38352: Add
IO,BinaryIO,TextIO,Match, andPatterntotyping.__all__. Patch by Jelle Zijlstra.bpo-43972: When
http.server.SimpleHTTPRequestHandlersends a301 (Moved Permanently)for a directory path not ending with/, add aContent-Length: 0header. This improves the behavior for certain clients.bpo-28528: Fix a bug in
pdbwherecheckline()raisesAttributeErrorif it is called afterreset().bpo-43776: When
subprocess.Popenargs are provided as a string or aspathlib.Path, the Popen instance repr now shows the right thing.bpo-43666: AIX:
Lib/_aix_support.get_platform()may fail in an AIX WPAR. The fileset bos.rte appears to have a builddate in both LPAR and WPAR so this fileset is queried rather than bos.mp64. To prevent a similiar situation (no builddate in ODM) a value (9988) sufficient for completing a build is provided. Patch by M Felt.bpo-43650: Fix
MemoryErrorinshutil.unpack_archive()which fails insideshutil._unpack_zipfile()on large files. Patch by Igor Bolshakov.bpo-43318: Fix a bug where
pdbdoes not always echo cleared breakpoints.bpo-43295:
datetime.datetime.strptime()now raisesValueErrorinstead ofIndexErrorwhen matching'z'with the%zformat specifier.bpo-37022:
pdbnow displays exceptions fromrepr()with itspandppcommands.
Documentation¶
bpo-40620: Convert examples in tutorial controlflow.rst section 4.3 to be interpreter-demo style.
bpo-13814: In the Design FAQ, answer “Why don’t generators support the with statement?”
bpo-44392: Added a new section in the C API documentation for types used in type hinting. Documented
Py_GenericAliasandPy_GenericAliasType.bpo-38291: Mark
typing.ioandtyping.reas deprecated since Python 3.8 in the documentation. They were never properly supported by type checkers.bpo-44322: Document that SyntaxError args have a details tuple and that details are adjusted for errors in f-string field replacement expressions.
bpo-44195: Corrected references to
TraversableResourcesin docs. There is noTraversableReader.bpo-41963: Document that
ConfigParserstrips off comments when reading configuration files.bpo-44072: Correct where in the numeric ABC hierarchy
**support is added, i.e., in numbers.Complex, not numbers.Integral.bpo-43558: Add the remark to
dataclassesdocumentation that the__init__()of any base class has to be called in__post_init__(), along with a code example.bpo-41621: Document that
collections.defaultdictparameterdefault_factorydefaults to None and is positional-only.
Tests¶
bpo-44287: Fix asyncio test_popen() of test_windows_utils by using a longer timeout. Use military grade battle-tested
test.support.SHORT_TIMEOUTtimeout rather than a hardcoded timeout of 10 seconds: it’s 30 seconds by default, but it is made longer on slow buildbots. Patch by Victor Stinner.bpo-44363: Account for address sanitizer in test_capi. test_capi now passes when run GCC address sanitizer.
Build¶
bpo-44381: The Windows build now accepts
EnableControlFlowGuardset toguardto enable CFG.
Windows¶
bpo-41299: Fix 16ms jitter when using timeouts in
threading, such as withthreading.Lock.acquire()orthreading.Condition.wait().
macOS¶
IDLE¶
bpo-40128: Mostly fix completions on macOS when not using tcl/tk 8.6.11 (as with 3.9). The added update_idletask call should be harmless and possibly helpful otherwise.
bpo-33962: Move the indent space setting from the Font tab to the new Windows tab. Patch by Mark Roseman and Terry Jan Reedy.
bpo-40468: Split the settings dialog General tab into Windows and Shell/ED tabs. Move help sources, which extend the Help menu, to the Extensions tab. Make space for new options and shorten the dialog. The latter makes the dialog better fit small screens.
bpo-41611: Avoid uncaught exceptions in
AutoCompleteWindow.winconfig_event().bpo-41611: Fix IDLE sometimes freezing upon tab-completion on macOS.
Tools/Demos¶
bpo-44074: Make patchcheck automatically detect the correct base branch name (previously it was hardcoded to ‘master’)
C API¶
bpo-44441:
Py_RunMain()now resetsPyImport_Inittabto its initial value at exit. It must be possible to callPyImport_AppendInittab()orPyImport_ExtendInittab()at each Python initialization. Patch by Victor Stinner.bpo-42083: Fix crash in
PyStructSequence_NewType()when passedNULLin the documentation string slot.
Python 3.9.5 final¶
Release date: 2021-05-03
Security¶
bpo-43434: Creating a
sqlite3.Connectionobject now also produces asqlite3.connectauditing event. Previously this event was only produced bysqlite3.connect()calls. Patch by Erlend E. Aasland.bpo-43882: The presence of newline or tab characters in parts of a URL could allow some forms of attacks.
Following the controlling specification for URLs defined by WHATWG
urllib.parse()now removes ASCII newlines and tabs from URLs, preventing such attacks.bpo-43472: Ensures interpreter-level audit hooks receive the
cpython.PyInterpreterState_Newevent when called through the_xxsubinterpretersmodule.bpo-36384:
ipaddressmodule no longer accepts any leading zeros in IPv4 address strings. Leading zeros are ambiguous and interpreted as octal notation by some libraries. For example the legacy functionsocket.inet_aton()treats leading zeros as octal notatation. glibc implementation of moderninet_pton()does not accept any leading zeros. For a while theipaddressmodule used to accept ambiguous leading zeros.bpo-43075: Fix Regular Expression Denial of Service (ReDoS) vulnerability in
urllib.request.AbstractBasicAuthHandler. The ReDoS-vulnerable regex has quadratic worst-case complexity and it allows cause a denial of service when identifying crafted invalid RFCs. This ReDoS issue is on the client side and needs remote attackers to control the HTTP server.bpo-42800: Audit hooks are now fired for frame.f_code, traceback.tb_frame, and generator code/frame attribute access.
Core and Builtins¶
bpo-43105: Importlib now resolves relative paths when creating module spec objects from file locations.
bpo-42924: Fix
bytearrayrepetition incorrectly copying data from the start of the buffer, even if the data is offset within the buffer (e.g. after reassigning a slice at the start of thebytearrayto a shorter byte string).
Library¶
bpo-43993: Update bundled pip to 21.1.1.
bpo-43937: Fixed the
turtlemodule working with non-default root window.bpo-43930: Update bundled pip to 21.1 and setuptools to 56.0.0
bpo-43920: OpenSSL 3.0.0:
load_verify_locations()now returns a consistent error message when cadata contains no valid certificate.bpo-43607:
urllibcan now convert Windows paths with\\?\prefixes into URL paths.bpo-43284: platform.win32_ver derives the windows version from sys.getwindowsversion().platform_version which in turn derives the version from kernel32.dll (which can be of a different version than Windows itself). Therefore change the platform.win32_ver to determine the version using the platform module’s _syscmd_ver private function to return an accurate version.
bpo-42248: [Enum] ensure exceptions raised in
_missing_are released.bpo-43799: OpenSSL 3.0.0: define
OPENSSL_API_COMPAT1.1.1 to suppress deprecation warnings. Python requires OpenSSL 1.1.1 APIs.bpo-43794: Add
ssl.OP_IGNORE_UNEXPECTED_EOFconstants (OpenSSL 3.0.0)bpo-43789: OpenSSL 3.0.0: Don’t call the password callback function a second time when first call has signaled an error condition.
bpo-43788: The header files for
sslerror codes are now OpenSSL version-specific. Exceptions will now show correct reason and library codes. Themake_ssl_data.pyscript has been rewritten to use OpenSSL’s text file with error codes.bpo-43655:
tkinterdialog windows are now recognized as dialogs by window managers on macOS and X Window.bpo-43534:
turtle.textinput()andturtle.numinput()create now a transient window working on behalf of the canvas window.bpo-43522: Fix problem with
hostname_checks_common_name. OpenSSL does not copy hostflags from struct SSL_CTX to struct SSL.bpo-42967: Allow
bytesseparatorargument inurllib.parse.parse_qsandurllib.parse.parse_qslwhen parsingstrquery strings. Previously, this raised aTypeError.bpo-43176: Fixed processing of a dataclass that inherits from a frozen dataclass with no fields. It is now correctly detected as an error.
bpo-41735: Fix thread locks in zlib module may go wrong in rare case. Patch by Ma Lin.
bpo-36470: Fix dataclasses with
InitVars andreplace(). Patch by Claudiu Popa.bpo-32745: Fix a regression in the handling of ctypes’
ctypes.c_wchar_ptype: embedded null characters would cause aValueErrorto be raised. Patch by Zackery Spytz.
Documentation¶
bpo-43959: The documentation on the PyContextVar C-API was clarified.
bpo-43938: Update dataclasses documentation to express that FrozenInstanceError is derived from AttributeError.
bpo-43755: Update documentation to reflect that unparenthesized lambda expressions can no longer be the expression part in an
ifclause in comprehensions and generator expressions since Python 3.9.bpo-43739: Fixing the example code in Doc/extending/extending.rst to declare and initialize the pmodule variable to be of the right type.
Tests¶
bpo-43961: Fix test_logging.test_namer_rotator_inheritance() on Windows: use
os.replace()rather thanos.rename(). Patch by Victor Stinner.bpo-43842: Fix a race condition in the SMTP test of test_logging. Don’t close a file descriptor (socket) from a different thread while asyncore.loop() is polling the file descriptor. Patch by Victor Stinner.
bpo-43811: Tests multiple OpenSSL versions on GitHub Actions. Use ccache to speed up testing.
bpo-43791: OpenSSL 3.0.0: Disable testing of legacy protocols TLS 1.0 and 1.1. Tests are failing with TLSV1_ALERT_INTERNAL_ERROR.
Windows¶
bpo-35306: Avoid raising errors from
pathlib.Path.exists()when passed an invalid filename.bpo-38822: Fixed
os.stat()failing on inaccessible directories with a trailing slash, rather than falling back to the parent directory’s metadata. This implicitly affectedos.path.exists()andos.path.isdir().bpo-26227: Fixed decoding of host names in
socket.gethostbyaddr()andsocket.gethostbyname_ex().bpo-40432: Updated pegen regeneration script on Windows to find and use Python 3.8 or higher. Prior to this, pegen regeneration already required 3.8 or higher, but the script may have used lower versions of Python.
bpo-43745: Actually updates Windows release to OpenSSL 1.1.1k. Earlier releases were mislabelled and actually included 1.1.1i again.
bpo-43492: Upgrade Windows installer to use SQLite 3.35.5.
macOS¶
bpo-42119: Fix check for macOS SDK paths when building Python. Narrow search to match contents of SDKs, namely only files in
/System/Library,/System/IOSSupport, and/usrother than/usr/local. Previously, anything under/Systemwas assumed to be in an SDK which causes problems with the new file system layout in 10.15+ where user file systems may appear to be mounted under/System. Paths in/Librarywere also incorrectly treated as SDK locations.bpo-44009: Provide “python3.x-intel64” executable to allow reliably forcing macOS universal2 framework builds to run under Rosetta 2 Intel-64 emulation on Apple Silicon Macs. This can be useful for testing or when universal2 wheels are not yet available.
bpo-43492: Update macOS installer to use SQLite 3.35.4.
IDLE¶
bpo-43655: IDLE dialog windows are now recognized as dialogs by window managers on macOS and X Window.
Python 3.9.4 final¶
Release date: 2021-04-04
Core and Builtins¶
bpo-43710: Reverted the fix for https://bugs.python.org/issue42500 as it changed the PyThreadState struct size and broke the 3.9.x ABI in the 3.9.3 release (visible on 32-bit platforms using binaries compiled using an earlier version of Python 3.9.x headers).
Library¶
Python 3.9.3 final¶
Release date: 2021-04-02
Security¶
bpo-42988: CVE-2021-3426: Remove the
getfilefeature of thepydocmodule which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer.bpo-43285:
ftplibno longer trusts the IP address value returned from the server in response to the PASV command by default. This prevents a malicious FTP server from using the response to probe IPv4 address and port combinations on the client network.Code that requires the former vulnerable behavior may set a
trust_server_pasv_ipv4_addressattribute on theirftplib.FTPinstances toTrueto re-enable it.bpo-43439: Add audit hooks for
gc.get_objects(),gc.get_referrers()andgc.get_referents(). Patch by Pablo Galindo.
Core and Builtins¶
bpo-43660: Fix crash that happens when replacing
sys.stderrwith a callable that can remove the object while an exception is being printed. Patch by Pablo Galindo.bpo-43555: Report the column offset for
SyntaxErrorfor invalid line continuation characters. Patch by Pablo Galindo.bpo-43517: Fix misdetection of circular imports when using
from pkg.mod import attr, which caused false positives in non-trivial multi-threaded code.bpo-35883: Python no longer fails at startup with a fatal error if a command line argument contains an invalid Unicode character. The
Py_DecodeLocale()function now escapes byte sequences which would be decoded as Unicode characters outside the [U+0000; U+10ffff] range.bpo-43406: Fix a possible race condition where
PyErr_CheckSignalstries to execute a non-Python signal handler.bpo-42500: Improve handling of exceptions near recursion limit. Converts a number of Fatal Errors in RecursionErrors.
Library¶
bpo-43433:
xmlrpc.client.ServerProxyno longer ignores query and fragment in the URL of the server.bpo-35930: Raising an exception raised in a “future” instance will create reference cycles.
bpo-43577: Fix deadlock when using
ssl.SSLContextdebug callback withssl.SSLContext.sni_callback().bpo-43521:
ast.unparsecan now render NaNs and empty sets.bpo-43423:
subprocess.communicate()no longer raises an IndexError when there is an empty stdout or stderr IO buffer during a timeout on Windows.bpo-27820: Fixed long-standing bug of smtplib.SMTP where doing AUTH LOGIN with initial_response_ok=False will fail.
The cause is that SMTP.auth_login _always_ returns a password if provided with a challenge string, thus non-compliant with the standard for AUTH LOGIN.
Also fixes bug with the test for smtpd.
bpo-43332: Improves the networking efficiency of
http.clientwhen using a proxy viaset_tunnel(). Fewer small send calls are made during connection setup.bpo-43399: Fix
ElementTree.extendnot working on iterators when using the Python implementationbpo-43316: The
python -m gzipcommand line application now properly fails when detecting an unsupported extension. It exits with a non-zero exit code and prints an error message to stderr.bpo-43260: Fix TextIOWrapper can not flush internal buffer forever after very large text is written.
bpo-42782: Fail fast in
shutil.move()to avoid creating destination directories on failure.bpo-37193: Fixed memory leak in
socketserver.ThreadingMixInintroduced in Python 3.7.
Documentation¶
bpo-43199: Answer “Why is there no goto?” in the Design and History FAQ.
bpo-43407: Clarified that a result from
time.monotonic(),time.perf_counter(),time.process_time(), ortime.thread_time()can be compared with the result from any following call to the same function - not just the next immediate call.bpo-27646: Clarify that ‘yield from <expr>’ works with any iterable, not just iterators.
bpo-36346: Update some deprecated unicode APIs which are documented as “will be removed in 4.0” to “3.12”. See PEP 623 for detail.
Tests¶
bpo-37945: Fix test_getsetlocale_issue1813() of test_locale: skip the test if
setlocale()fails. Patch by Victor Stinner.bpo-41561: Add workaround for Ubuntu’s custom OpenSSL security level policy.
bpo-43288: Fix test_importlib to correctly skip Unicode file tests if the fileystem does not support them.
Build¶
macOS¶
bpo-41837: Update macOS installer build to use OpenSSL 1.1.1j.
IDLE¶
bpo-42225: Document that IDLE can fail on Unix either from misconfigured IP masquerage rules or failure displaying complex colored (non-ascii) characters.
bpo-43283: Document why printing to IDLE’s Shell is often slower than printing to a system terminal and that it can be made faster by pre-formatting a single string before printing.
Python 3.9.2 final¶
Release date: 2021-02-19
Windows¶
bpo-43155:
PyCMethod_New()is now present inpython3.lib.
Python 3.9.2 release candidate 1¶
Release date: 2021-02-16
Security¶
bpo-42967: Fix web cache poisoning vulnerability by defaulting the query args separator to
&, and allowing the user to choose a custom separator.bpo-42938: Avoid static buffers when computing the repr of
ctypes.c_doubleandctypes.c_longdoublevalues.
Core and Builtins¶
bpo-42819:
readline: Explicitly disable bracketed paste in the interactive interpreter, even if it’s set in the inputrc, is enabled by default (eg GNU Readline 8.1), or a user callsreadline.read_init_file(). The Python REPL has not implemented bracketed paste support. Also, bracketed mode writes the"\x1b[?2004h"escape sequence into stdout which causes test failures in applications that don’t support it. It can still be explicitly enabled by callingreadline.parse_and_bind("set enable-bracketed-paste on"). Patch by Dustin Rodrigues.bpo-42806: Fix the column offsets for f-strings
astnodes surrounded by parentheses and for nodes that spawn multiple lines. Patch by Pablo Galindo.bpo-40631: Fix regression where a single parenthesized starred expression was a valid assignment target.
bpo-32381: Fix encoding name when running a
.pycfile on Windows:PyRun_SimpleFileExFlags()now uses the correct encoding to decode the filename.bpo-42536: Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector:
Previously, they could have become untracked by a prior garbage collection. Patch by Brandt Bucher.
bpo-42195: The
__args__of the parameterized generics fortyping.Callableandcollections.abc.Callableare now consistent. The__args__forcollections.abc.Callableare now flattened whiletyping.Callable’s have not changed. To allow this change,types.GenericAliascan now be subclassed andcollections.abc.Callable’s__class_getitem__will now return a subclass oftypes.GenericAlias. Tests for typing were also updated to not subclass things likeCallable[..., T]as that is not a valid base class. Finally, both types no longer validate theirargtypes, inCallable[[argtypes], resulttype]to prepare for PEP 612. Patch by Ken Jin.
Library¶
bpo-43102: The namedtuple __new__ method had its __builtins__ set to None instead of an actual dictionary. This created problems for introspection tools.
bpo-43108: Fixed a reference leak in the
cursesmodule. Patch by Pablo Galindobpo-42944: Fix
random.Random.samplewhencountsargument is notNone.bpo-42931: Add
randbytes()torandom.__all__.bpo-42780: Fix os.set_inheritable() for O_PATH file descriptors on Linux.
bpo-42851: remove __init_subclass__ support for Enum members
bpo-41748: Fix HTMLParser parsing rules for element attributes containing commas with spaces. Patch by Karl Dubost.
bpo-42759: Fixed equality comparison of
tkinter.Variableandtkinter.font.Font. Objects which belong to different Tcl interpreters are now always different, even if they have the same name.bpo-42756: Configure LMTP Unix-domain socket to use socket global default timeout when a timeout is not explicitly provided.
bpo-23328: Allow / character in username, password fields on _PROXY envars.
bpo-42655:
subprocessextra_groups is now correctly passed into setgroups() system call.bpo-42727:
EnumMeta.__prepare__now accepts**kwdsto properly support__init_subclass__bpo-42681: Fixed range checks for color and pair numbers in
curses.bpo-37961: Fix crash in
tracemalloc.Traceback.__repr__()(regressed in Python 3.9).bpo-42630:
tkinterfunctions and constructors which need a default root window raise nowRuntimeErrorwith descriptive message instead of obscureAttributeErrororNameErrorif it is not created yet or cannot be created automatically.bpo-42644:
logging.disablewill now validate the types and value of its parameter. It also now accepts strings representing the levels (as doesloging.setLevel) instead of only the numerical values.bpo-36541: Fixed lib2to3.pgen2 to be able to parse PEP-570 positional only argument syntax.
bpo-42517: Enum: private names will raise a DeprecationWarning; in 3.10 they will become normal attributes
bpo-42678:
Enum: call__init_subclass__after members have been addedbpo-42532: Remove unexpected call of
__bool__when passing aspec_argargument to a Mock.bpo-42388: Fix subprocess.check_output(…, input=None) behavior when text=True to be consistent with that of the documentation and universal_newlines=True.
bpo-34463: Fixed discrepancy between
tracebackand the interpreter in formatting of SyntaxError with lineno not set (tracebackwas changed to match interpreter).bpo-42375: subprocess module update for DragonFlyBSD support.
bpo-42384: Make pdb populate sys.path[0] exactly the same as regular python execution.
bpo-42383: Fix pdb: previously pdb would fail to restart the debugging target if it was specified using a relative path and the current directory changed.
bpo-42318: Fixed support of non-BMP characters in
tkinteron macOS.bpo-42163: Restore compatibility for
uname_resultaround deepcopy and _replace.bpo-39825: Windows: Change
sysconfig.get_config_var('EXT_SUFFIX')to the expected fullplatform_tag.extensionformat. Previously it was hard-coded to.pyd, now it is compatible withdistutils.sysconfigand will result in something like.cp38-win_amd64.pyd. This brings windows into conformance with the other platforms.bpo-42059:
typing.TypedDicttypes created using the alternative call-style syntax now correctly respect thetotalkeyword argument when setting their__required_keys__and__optional_keys__class attributes.bpo-39101: Fixed tests using IsolatedAsyncioTestCase from hanging on BaseExceptions.
bpo-42005: Fix CLI of
cProfileandprofileto catchBrokenPipeError.bpo-41889: Enum: fix regression involving inheriting a multiply-inherited enum
bpo-41891: Ensure asyncio.wait_for waits for task completion
bpo-41604: Don’t decrement the reference count of the previous user_ptr when set_panel_userptr fails.
bpo-40219: Lowered
tkinter.ttk.LabeledScaledummy widget to prevent hiding part of the content label.bpo-40084: Fix
Enum.__dir__: dir(Enum.member) now includes attributes as well as methods.bpo-39068: Fix initialization race condition in
a85encode()andb85encode()inbase64. Patch by Brandon Stansbury.bpo-33289: Correct call to
tkinter.colorchooserto return RGB triplet of ints instead of floats. Patch by Cheryl Sabella.
Documentation¶
bpo-40304: Fix doc for type(name, bases, dict). Patch by Boris Verkhovskiy and Éric Araujo.
bpo-42811: Updated importlib.utils.resolve_name() doc to use __spec__.parent instead of __package__. (Thanks Yair Frid.)
bpo-17140: Add documentation for the
multiprocessing.pool.ThreadPoolclass.
Tests¶
Build¶
bpo-43174: Windows build now uses
/utf-8compiler option.bpo-42692: Fix __builtin_available check on older compilers. Patch by Joshua Root.
bpo-42604: Now all platforms use a value for the “EXT_SUFFIX” build variable derived from SOABI (for instance in freeBSD, “EXT_SUFFIX” is now “.cpython-310d.so” instead of “.so”). Previosuly only Linux, Mac and VxWorks were using a value for “EXT_SUFFIX” that included “SOABI”.
bpo-42598: Fix implicit function declarations in configure which could have resulted in incorrect configuration checks. Patch contributed by Joshua Root.
bpo-29076: Add fish shell support to macOS installer.
Windows¶
macOS¶
bpo-42504: Ensure that the value of sysconfig.get_config_var(‘MACOSX_DEPLOYMENT_TARGET’) is always a string, even in when the value is parsable as an integer.
bpo-42361: Update macOS installer build to use Tcl/Tk 8.6.11 (rc2, expected to be final release).
bpo-41837: Update macOS installer build to use OpenSSL 1.1.1i.
bpo-42584: Update macOS installer to use SQLite 3.34.0.
IDLE¶
bpo-43008: Make IDLE invoke
sys.excepthook()in normal, 2-process mode. Patch by Ken Hilton.bpo-33065: Fix problem debugging user classes with __repr__ method.
bpo-23544: Disable Debug=>Stack Viewer when user code is running or Debugger is active, to prevent hang or crash. Patch by Zackery Spytz.
bpo-32631: Finish zzdummy example extension module: make menu entries work; add docstrings and tests with 100% coverage.
Tools/Demos¶
C API¶
bpo-43030: Fixed a compiler warning in
Py_UNICODE_ISSPACE()on platforms with signedwchar_t.bpo-42591: Export the
Py_FrozenMain()function: fix a Python 3.9.0 regression. Python 3.9 uses-fvisibility=hiddenand the function was not exported explicitly and so not exported.bpo-40052: Fix an alignment build warning/error in function
PyVectorcall_Function(). Patch by Andreas Schneider, Antoine Pitrou and Petr Viktorin.
Python 3.9.1 final¶
Release date: 2020-12-07
Core and Builtins¶
bpo-42576:
types.GenericAliaswill now raise aTypeErrorwhen attempting to initialize with a keyword argument. Previously, this would cause the interpreter to crash if the interpreter was compiled with debug symbols. This does not affect interpreters compiled for release. Patch by Ken Jin.
Library¶
bpo-5054: CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly parsed. Replace the special purpose getallmatchingheaders with generic get_all method and add relevant tests.
Original Patch by Martin Panter. Modified by Senthil Kumaran.
bpo-17735:
inspect.findsource()now raisesOSErrorinstead ofIndexErrorwhenco_linenoof a code object is greater than the file length. This can happen, for example, when a file is edited after it was imported. PR by Irit Katriel.bpo-42116: Fix handling of trailing comments by
inspect.getsource().bpo-42487: ChainMap.__iter__ no longer calls __getitem__ on underlying maps
bpo-42482:
TracebackExceptionno longer holds a reference to the exception’s traceback object. Consequently, instances of TracebackException for equivalent but non-equal exceptions now compare as equal.bpo-42406: We fixed an issue in
pickle.whichmodulein which importingmultiprocessingcould change the how pickle identifies which module an object belongs to, potentially breaking the unpickling of those objects.bpo-34215: Clarify the error message for
asyncio.IncompleteReadErrorwhenexpectedisNone.bpo-12800: Extracting a symlink from a tarball should succeed and overwrite the symlink if it already exists. The fix is to remove the existing file or symlink before extraction. Based on patch by Chris AtLee, Jeffrey Kintscher, and Senthil Kumaran.
Tests¶
bpo-41473: Reenable test_gdb on gdb 9.2 and newer: https://bugzilla.redhat.com/show_bug.cgi?id=1866884 bug is fixed in gdb 10.1.
bpo-42553: Fix
test_asyncio.test_call_later()race condition: don’t measure asyncio performance in thecall_later()unit test. The test failed randomly on the CI.
macOS¶
IDLE¶
bpo-42508: Keep IDLE running on macOS. Remove obsolete workaround that prevented running files with shortcuts when using new universal2 installers built on macOS 11.
Python 3.9.1 release candidate 1¶
Release date: 2020-11-24
Security¶
bpo-42103: Prevented potential DoS attack via CPU and RAM exhaustion when processing malformed Apple Property List files in binary format.
bpo-42051: The
plistlibmodule no longer accepts entity declarations in XML plist files to avoid XML vulnerabilities. This should not affect users as entity declarations are not used in regular plist files.bpo-40791: Add
volatileto the accumulator variable inhmac.compare_digest, making constant-time-defeating optimizations less likely.
Core and Builtins¶
bpo-41686: On Windows, the
SIGINTevent,_PyOS_SigintEvent(), is now created even if Python is configured to not install signal handlers (ifPyConfig.install_signal_handlersequals to 0, orPy_InitializeEx(0)).bpo-42381: Allow assignment expressions in set literals and set comprehensions as per PEP 572. Patch by Pablo Galindo.
bpo-42374: Fix a regression introduced by the new parser, where an unparenthesized walrus operator was not allowed within generator expressions.
bpo-42296: On Windows, fix a regression in signal handling which prevented to interrupt a program using CTRL+C. The signal handler can be run in a thread different than the Python thread, in which case the test deciding if the thread can handle signals is wrong.
bpo-42332:
types.GenericAliasobjects can now be the targets of weakrefs.bpo-42218: Fixed a bug in the PEG parser that was causing crashes in debug mode. Now errors are checked in left-recursive rules to avoid cases where such errors do not get handled in time and appear as long-distance crashes in other places.
bpo-42214: Fixed a possible crash in the PEG parser when checking for the ‘!=’ token in the
barry_as_fluflrule. Patch by Pablo Galindo.bpo-42143: Fix handling of errors during creation of
PyFunctionObject, which resulted in operations on uninitialized memory. Patch by Yonatan Goldschmidt.bpo-41659: Fix a bug in the parser, where a curly brace following a
primarydidn’t fail immediately. This led to invalid expressions likea {b}to throw aSyntaxErrorwith a wrong offset, or invalid expressions ending with a curly brace likea {to not fail immediately in the REPL.bpo-42150: Fix possible buffer overflow in the new parser when checking for continuation lines. Patch by Pablo Galindo.
bpo-42123: Run the parser two times. On the first run, disable all the rules that only generate better error messages to gain performance. If there’s a parse failure, run the parser a second time with those enabled.
bpo-42057: Fix peephole optimizer misoptimize conditional jump + JUMP_IF_NOT_EXC_MATCH pair.
bpo-41984: The garbage collector now tracks all user-defined classes. Patch by Brandt Bucher.
bpo-41993: Fixed potential issues with removing not completely initialized module from
sys.moduleswhen import fails.bpo-41979: Star-unpacking is now allowed for with item’s targets in the PEG parser.
bpo-41909: Fixed stack overflow in
issubclass()andisinstance()when getting the__bases__attribute leads to infinite recursion.bpo-41894: When loading a native module and a load failure occurs, prevent a possible UnicodeDecodeError when not running in a UTF-8 locale by decoding the load error message using the current locale’s encoding.
bpo-39934: Correctly count control blocks in ‘except’ in compiler. Ensures that a syntax error, rather a fatal error, occurs for deeply nested, named exception handlers.
Library¶
bpo-42328: Fixed
tkinter.ttk.Style.map(). The function accepts now the representation of the default state as empty sequence (as returned byStyle.map()). The structure of the result is now the same on all platform and does not depend on the value ofwantobjects.bpo-42345: Fix various issues with
typing.Literalparameter handling (flatten, deduplicate, use type to cache key). Patch provided by Yurii Karabas.bpo-42350: Fix the
threading.Threadclass at fork: do nothing if the thread is already stopped (ex: fork called at Python exit). Previously, an error was logged in the child process.bpo-42014: The
onerrorcallback fromshutil.rmtreenow receives correct function whenos.openfails.bpo-42237: Fix
os.sendfile()on illumos.bpo-42249: Fixed writing binary Plist files larger than 4 GiB.
bpo-35455: On Solaris,
thread_time()is now implemented withgethrvtime()becauseclock_gettime(CLOCK_THREAD_CPUTIME_ID)is not always available. Patch by Jakub Kulik.bpo-42233: The
repr()oftypingtypes containing Generic Alias Types previously did not show the parameterized types in theGenericAlias. They have now been changed to do so.bpo-41754: webbrowser: Ignore NotADirectoryError when calling
xdg-settings.bpo-29566:
binhex.binhex()consisently writes macOS 9 line endings.bpo-42183: Fix a stack overflow error for asyncio Task or Future repr().
The overflow occurs under some circumstances when a Task or Future recursively returns itself.
bpo-42146: Fix memory leak in
subprocess.Popen()in case an uid (gid) specified inuser(group,extra_groups) overflowsuid_t(gid_t).bpo-42140: Improve asyncio.wait function to create the futures set just one time.
bpo-42103:
InvalidFileExceptionandRecursionErrorare now the only errors caused by loading malformed binary Plist file (previously ValueError and TypeError could be raised in some specific cases).bpo-41052: Pickling heap types implemented in C with protocols 0 and 1 raises now an error instead of producing incorrect data.
bpo-41491: plistlib: fix parsing XML plists with hexadecimal integer values
bpo-42065: Fix an incorrectly formatted error from
_codecs.charmap_decode()when called with a mapped value outside the range of valid Unicode code points. PR by Max Bernstein.bpo-41966: Fix pickling pure Python
datetime.timesubclasses. Patch by Dean Inwood.bpo-41976: Fixed a bug that was causing
ctypes.util.find_library()to returnNonewhen triying to locate a library in an environment when gcc>=9 is available andldconfigis not. Patch by Pablo Galindobpo-41900: C14N 2.0 serialisation in xml.etree.ElementTree failed for unprefixed attributes when a default namespace was defined.
bpo-41840: Fix a bug in the
symtablemodule that was causing module-scope global variables to not be reported as both local and global. Patch by Pablo Galindo.bpo-41831:
str()for thetypeattribute of thetkinter.Eventobject always returns now the numeric code returned by Tk instead of the name of the event type.bpo-41817: fix
tkinter.EventTypeEnum so all members are strings, and none are tuplesbpo-41815: Fix SQLite3 segfault when backing up closed database. Patch contributed by Peter David McCormick.
bpo-41316: Fix the
tarfilemodule to write only basename of TAR file to GZIP compression header.bpo-16396: Allow
ctypes.wintypesto be imported on non-Windows systems.bpo-40592:
shutil.which()now ignores empty entries inPATHEXTinstead of treating them as a match.bpo-40550: Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal.
bpo-40492: Fix
--outfileforcProfile/profilenot writing the output file in the original directory when the program being profiled changes the working directory. PR by Anthony Sottile.bpo-40105: ZipFile truncates files to avoid corruption when a shorter comment is provided in append (“a”) mode. Patch by Jan Mazur.
bpo-27321: Fixed KeyError exception when flattening an email to a string attempts to replace a non-existent Content-Transfer-Encoding header.
Documentation¶
bpo-42153: Fix the URL for the IMAP protocol documents.
bpo-42061: Document __format__ functionality for IP addresses.
bpo-41910: Document the default implementation of
object.__eq__.bpo-42010: Clarify that subscription expressions are also valid for certain classes and types in the standard library, and for user-defined classes and types if the classmethod
__class_getitem__()is provided.bpo-41805: Documented generic alias type and
types.GenericAlias. Also added an entry in glossary for generic types.bpo-41774: In Programming FAQ “Sequences (Tuples/Lists)” section, add “How do you remove multiple items from a list”.
bpo-35293: Fix RemovedInSphinx40Warning when building the documentation. Patch by Dong-hee Na.
bpo-41726: Update the refcounts info of
PyType_FromModuleAndSpec.bpo-39693: Fix tarfile’s extractfile documentation
bpo-39416: Document some restrictions on the default string representations of numeric classes.
Tests¶
bpo-40754: Include
_testinternalcapimodule in Windows installer for test suitebpo-41739: Fix test_logging.test_race_between_set_target_and_flush(): the test now waits until all threads complete to avoid leaking running threads.
bpo-41970: Avoid a test failure in
test_lib2to3if the module has already imported at the time the test executes. Patch by Pablo Galindo.bpo-41944: Tests for CJK codecs no longer call
eval()on content received via HTTP.bpo-41939: Fix test_site.test_license_exists_at_url(): call
urllib.request.urlcleanup()to reset the globalurllib.request._opener. Patch by Victor Stinner.bpo-41561: test_ssl: skip test_min_max_version_mismatch when TLS 1.0 is not available
bpo-41602: Add tests for SIGINT handling in the runpy module.
bpo-41306: Fixed a failure in
test_tk.test_widgets.ScaleTesthappening when executing the test with Tk 8.6.10.
Build¶
bpo-42398: Fix a race condition in “make regen-all” when make -jN option is used to run jobs in parallel. The clinic.py script now only use atomic write to write files. Moveover, generated files are now left unchanged if the content does not change, to not change the file modification time.
bpo-41617: Fix building
pycore_bitutils.hinternal header on old clang version without__builtin_bswap16()(ex: Xcode 4.6.3 on Mac OS X 10.7). Patch by Joshua Root and Victor Stinner.bpo-38249: Update
Py_UNREACHABLEto use __builtin_unreachable() if only the compiler is able to use it. Patch by Dong-hee Na.bpo-40998: Addressed three compiler warnings found by undefined behavior sanitizer (ubsan).
Windows¶
bpo-42120: Remove macro definition of
copysign(to_copysign) in headers.bpo-38439: Updates the icons for IDLE in the Windows Store package.
bpo-41744: Fixes automatic import of props file when using the Nuget package.
bpo-41557: Update Windows installer to use SQLite 3.33.0.
bpo-38324: Avoid Unicode errors when accessing certain locale data on Windows.
macOS¶
bpo-41116: Ensure distutils.unixxcompiler.find_library_file can find system provided libraries on macOS 11.
bpo-41100: Add support for macOS 11 and Apple Silicon systems.
It is now possible to build “Universal 2” binaries using “–enable-universalsdk –with-universal-archs=universal2”.
Binaries build on later macOS versions can be deployed back to older versions (tested up to macOS 10.9), when using the correct deployment target. This is tested using Xcode 11 and later.
bpo-38443: The
--enable-universalsdkand--with-universal-archsoptions for the configure script now check that the specified architectures can be used.bpo-41471: Ignore invalid prefix lengths in system proxy excludes.
bpo-41557: Update macOS installer to use SQLite 3.33.0.
IDLE¶
bpo-42426: Fix reporting offset of the RE error in searchengine.
bpo-42415: Get docstrings for IDLE calltips more often by using inspect.getdoc.
bpo-33987: Mostly finish using ttk widgets, mainly for editor, settings, and searches. Some patches by Mark Roseman.
bpo-41775: Use ‘IDLE Shell’ as shell title
bpo-35764: Rewrite the Calltips doc section.
bpo-40181: In calltips, stop reminding that ‘/’ marks the end of positional-only arguments.
bpo-40511: Typing opening and closing parentheses inside the parentheses of a function call will no longer cause unnecessary “flashing” off and on of an existing open call-tip, e.g. when typed in a string literal.
bpo-38439: Add a 256×256 pixel IDLE icon to the Windows .ico file. Created by Andrew Clover. Remove the low-color gif variations from the .ico file.
C API¶
Python 3.9.0 final¶
Release date: 2020-10-04
Library¶
bpo-41815: Fix SQLite3 segfault when backing up closed database. Patch contributed by Peter David McCormick.
bpo-41662: No longer override exceptions raised in
__len__()of a sequence of parameters insqlite3withProgrammingError.bpo-41662: Fixed crash when mutate list of parameters during iteration in
sqlite3.bpo-39728: fix default
_missing_so a duplicateValueErroris not set as the__context__of the originalValueError
Tests¶
bpo-41602: Add tests for SIGINT handling in the runpy module.
Build¶
bpo-38249: Update
Py_UNREACHABLEto use __builtin_unreachable() if only the compiler is able to use it. Patch by Dong-hee Na.
Python 3.9.0 release candidate 2¶
Release date: 2020-09-16
Core and Builtins¶
bpo-41780: Fix
__dir__()oftypes.GenericAlias. Patch by Batuhan Taskaya.bpo-41690: Fix a possible stack overflow in the parser when parsing functions and classes with a huge ammount of arguments. Patch by Pablo Galindo.
bpo-41681: Fixes the wrong error description in the error raised by using 2
,in format string in f-string andstr.format().bpo-41654: Fix a crash that occurred when destroying subclasses of
MemoryError. Patch by Pablo Galindo.bpo-41631: The
_astmodule uses again a global state. Using a module state per module instance is causing subtle practical problems. For example, the Mercurial project replaces the__import__()function to implement lazy import, whereas Python expected thatimport _astalways return a fully initialized_astmodule.bpo-41533: Free the stack allocated in
va_build_stackifdo_mkstackfails and the stack is not asmall_stack.bpo-41531: Fix a bug that was dropping keys when compiling dict literals with more than 0xFFFF elements. Patch by Pablo Galindo.
bpo-41525: The output of
python --helpcontains now only ASCII characters.bpo-29590: Make the stack trace correct after calling
generator.throw()on a generator that has yielded from ayield from.
Library¶
bpo-41517: fix bug allowing Enums to be extended via multiple inheritance
bpo-39587: use the correct mix-in data type when constructing Enums
bpo-41789: Honor
objectoverrides inEnumclass creation (specifically,__str__,__repr__,__format__, and__reduce_ex__).bpo-39651: Fix a race condition in the
call_soon_threadsafe()method ofasyncio.ProactorEventLoop: do nothing if the self-pipe socket has been closed.bpo-41720: Fixed
turtle.Vec2D.__rmul__()for arguments which are not int or float.bpo-41696: Fix handling of debug mode in
asyncio.run(). This allows settingPYTHONASYNCIODEBUGor-X devto enable asyncio debug mode when usingasyncio.run().bpo-41687: Fix implementation of sendfile to be compatible with Solaris.
bpo-39010: Restarting a
ProactorEventLoopon Windows no longer logs spuriousConnectionResetErrors.bpo-41609: The pdb whatis command correctly reports instance methods as ‘Method’ rather than ‘Function’.
bpo-32751: When cancelling the task due to a timeout,
asyncio.wait_for()will now wait until the cancellation is complete also in the case when timeout is <= 0, like it does with positive timeouts.bpo-37658:
asyncio.wait_for()now properly handles races between cancellation of itself and the completion of the wrapped awaitable.bpo-40782: Change the method asyncio.AbstractEventLoop.run_in_executor to not be a coroutine.
bpo-41520: Fix
codeopregression that prevented turning compile warnings into errors.bpo-41503: Fixed a race between setTarget and flush in logging.handlers.MemoryHandler.
bpo-41344: Prevent creating
shared_memory.SharedMemoryobjects withsize=0.bpo-41025: Fixed an issue preventing the C implementation of
zoneinfo.ZoneInfofrom being subclassed.bpo-31122: ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation
bpo-33660: Fix pathlib.PosixPath to resolve a relative path located on the root directory properly.
Documentation¶
bpo-37149: Change Shipman tkinter doc link from archive.org to TkDocs. (The doc has been removed from the NMT server.) The new link responds much faster and includes a short explanatory note.
bpo-41624: Fix the signature of
typing.Coroutine.bpo-40204: Enable Sphinx 3.2
c_allow_pre_v3option and disablec_warn_on_allowed_pre_v3option to make the documentation compatible with Sphinx 2 and Sphinx 3.bpo-40979: Refactored typing.rst, arranging more than 70 classes, functions, and decorators into new sub-sections.
bpo-39883: Make code, examples, and recipes in the Python documentation be licensed under the more permissive BSD0 license in addition to the existing Python 2.0 license.
Tests¶
bpo-41731: Make test_cmd_line_script pass with option ‘-vv’.
Build¶
bpo-41617: Fix
pycore_byteswap.hheader file to support old clang versions:__builtin_bswap16()is not available in LLVM clang 3.0.
Windows¶
bpo-41526: Fixed layout of final page of the installer by removing the special thanks to Mark Hammond (with his permission).
C API¶
bpo-41524: Fix bug in PyOS_mystrnicmp and PyOS_mystricmp that incremented pointers beyond the end of a string.
Python 3.9.0 release candidate 1¶
Release date: 2020-08-11
Core and Builtins¶
bpo-38156: Handle interrupts that come after EOF correctly in
PyOS_StdioReadline.
Library¶
bpo-41497: Fix potential UnicodeDecodeError in dis module.
bpo-41490: Update
ensurepipto install pip 20.2.1 and setuptools 49.2.1.bpo-41467: On Windows, fix asyncio
recv_into()return value when the socket/pipe is closed (BrokenPipeError): return0rather than an empty byte string (b'').bpo-41425: Make tkinter doc example runnable.
bpo-41384: Raise TclError instead of TypeError when an unknown option is passed to tkinter.OptionMenu.
bpo-38731: Fix
NameErrorin command-line interface ofpy_compile.bpo-41317: Use add_done_callback() in asyncio.loop.sock_accept() to unsubscribe reader early on cancellation.
bpo-41341: Recursive evaluation of
typing.ForwardRefinget_type_hints.bpo-41182: selector: use DefaultSelector based upon implementation
bpo-40726: Handle cases where the
end_linenoisNoneonast.increment_lineno().
Documentation¶
Windows¶
bpo-41492: Fixes the description that appears in UAC prompts.
bpo-40948: Improve post-install message to direct people to the “py” command.
bpo-41412: The installer will now fail to install on Windows 7 and Windows 8. Further, the UCRT dependency is now always downloaded on demand.
bpo-40741: Update Windows release to include SQLite 3.32.3.
IDLE¶
Python 3.9.0 beta 5¶
Release date: 2020-07-20
Security¶
bpo-41304: Fixes
python3x._pthbeing ignored on Windows, caused by the fix for bpo-29778 (CVE-2020-15801).bpo-41162: Audit hooks are now cleared later during finalization to avoid missing events.
bpo-29778: Ensure
python3.dllis loaded from correct locations when Python is embedded (CVE-2020-15523).bpo-39603: Prevent http header injection by rejecting control characters in http.client.putrequest(…).
Core and Builtins¶
bpo-41295: Resolve a regression in CPython 3.8.4 where defining “__setattr__” in a multi-inheritance setup and calling up the hierarchy chain could fail if builtins/extension types were involved in the base types.
bpo-41247: Always cache the running loop holder when running
asyncio.set_running_loop.bpo-41252: Fix incorrect refcounting in _ssl.c’s
_servername_callback().bpo-41215: Use non-NULL default values in the PEG parser keyword list to overcome a bug that was preventing Python from being properly compiled when using the XLC compiler. Patch by Pablo Galindo.
bpo-41218: Python 3.8.3 had a regression where compiling with ast.PyCF_ALLOW_TOP_LEVEL_AWAIT would aggressively mark list comprehension with CO_COROUTINE. Now only list comprehension making use of async/await will tagged as so.
bpo-41175: Guard against a NULL pointer dereference within bytearrayobject triggered by the
bytearray() + bytearray()operation.bpo-39960: The “hackcheck” that prevents sneaking around a type’s __setattr__() by calling the superclass method was rewritten to allow C implemented heap types.
Library¶
bpo-41288: Unpickling invalid NEWOBJ_EX opcode with the C implementation raises now UnpicklingError instead of crashing.
bpo-39017: Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907).
bpo-41235: Fix the error handling in
ssl.SSLContext.load_dh_params().bpo-41207: In distutils.spawn, restore expectation that DistutilsExecError is raised when the command is not found.
bpo-39168: Remove the
__new__method oftyping.Generic.bpo-41194: Fix a crash in the
_astmodule: it can no longer be loaded more than once. It now uses a global state rather than a module state.bpo-39384: Fixed email.contentmanager to allow set_content() to set a null string.
Documentation¶
bpo-37703: Updated Documentation to comprehensively elaborate on the behaviour of gather.cancel()
macOS¶
bpo-40741: Update macOS installer to use SQLite 3.32.3.
IDLE¶
C API¶
bpo-40170: Revert
PyType_HasFeature()change: it reads again directly thePyTypeObject.tp_flagsmember when the limited C API is not used, rather than always callingPyType_GetFlags()which hides implementation details.
Python 3.9.0 beta 4¶
Release date: 2020-07-02
Security¶
bpo-41004: The __hash__() methods of ipaddress.IPv4Interface and ipaddress.IPv6Interface incorrectly generated constant hash values of 32 and 128 respectively. This resulted in always causing hash collisions. The fix uses hash() to generate hash values for the tuple of (address, mask length, network address).
Core and Builtins¶
bpo-41094: Fix decoding errors with audit when open files with non-ASCII names on non-UTF-8 locale.
bpo-41084: Prefix the error message with ‘f-string: ‘, when parsing an f-string expression which throws a
SyntaxError.bpo-41076: Pre-feed the parser with the location of the f-string expression, not the f-string itself, which allows us to skip the shifting of the AST node locations after the parsing is completed.
bpo-40939: Deprecate
PyNode_Compile().bpo-41056: Fixes a reference to deallocated stack space during startup when constructing sys.path involving a relative symlink when code was supplied via -c. (discovered via Coverity)
bpo-41061: Fix incorrect expressions and asserts in hashtable code and tests.
bpo-41052: Opt out serialization/deserialization for _random.Random
bpo-40939: Deprecate
PyParser_SimpleParseStringFlags(),PyParser_SimpleParseStringFlagsFilename()andPyParser_SimpleParseFileFlags().bpo-35975: Stefan Behnel reported that cf_feature_version is used even when PyCF_ONLY_AST is not set. This is against the intention and against the documented behavior, so it’s been fixed.
bpo-40985: Fix a bug that caused the
SyntaxErrortext to be empty when a file ends with a line ending in a line continuation character (i.e. backslash). The error text should contain the text of the last line.bpo-40958: Fix a possible buffer overflow in the PEG parser when gathering information for emitting syntax errors. Patch by Pablo Galindo.
bpo-40957: Fix refleak in _Py_fopen_obj() when PySys_Audit() fails
bpo-40947: The Python Path Configuration now takes
PyConfig.platlibdirin account.bpo-40847: Fix a bug where a line with only a line continuation character is not considered a blank line at tokenizer level. In such cases, more than a single
NEWLINEtoken was emitted. The old parser was working around the issue, but the new parser threw aSyntaxErrorfor valid input due to this. For example, an empty line following a line continuation character was interpreted as aSyntaxError.bpo-40824: Unexpected errors in calling the
__iter__method are no longer masked byTypeErrorin theinoperator and functionscontains(),indexOf()andcountOf()of theoperatormodule.bpo-19569: Add the private macros
_Py_COMP_DIAG_PUSH,_Py_COMP_DIAG_IGNORE_DEPR_DECLS, and_Py_COMP_DIAG_POP.
Library¶
bpo-41193: The
write_history()atexit function of the readline completer now ignores anyOSErrorto ignore error if the filesystem is read-only, instead of only ignoringFileNotFoundErrorandPermissionError.bpo-41161: The decimal module now requires libmpdec-2.5.0. Users of –with-system-libmpdec should update their system library.
bpo-40874: The decimal module now requires libmpdec-2.5.0.
bpo-41138: Fixed the
tracemodule CLI for Python source files with non-UTF-8 encoding.bpo-31938: Fix default-value signatures of several functions in the
selectmodule - by Anthony Sottile.bpo-41068: Fixed reading files with non-ASCII names from ZIP archive directly after writing them.
bpo-41058:
pdb.find_function()now correctly determines the source file encoding.bpo-41056: Fix a NULL pointer dereference within the ssl module during a MemoryError in the keylog callback. (discovered by Coverity)
bpo-41056: Fixed an instance where a MemoryError within the zoneinfo module might not be reported or not reported at its source. (found by Coverity)
bpo-41048:
mimetypes.read_mime_types()function reads the rule file using UTF-8 encoding, not the locale encoding. Patch by Srinivas Reddy Thatiparthy.bpo-41043: Fixed the use of
glob()in the stdlib: literal part of the path is now always correctly escaped.bpo-40448:
ensurepipnow disables the use ofpipcache when installing the bundled versions ofpipandsetuptools. Patch by Krzysztof Konopko.bpo-40967: Removed
asyncio.Task.current_task()andasyncio.Task.all_tasks(). Patch contributed by Rémi Lapeyre.bpo-40955: Fix a minor memory leak in
subprocessmodule when extra_groups was specified.bpo-40855: The standard deviation and variance functions in the statistics module were ignoring their mu and xbar arguments.
bpo-40924: Removed support for loaders implementing .files and supplying TraversableResources.
bpo-40939: Use the new PEG parser when generating the stdlib
keywordmodule.bpo-40834: Fix truncate when sending str object with_xxsubinterpreters.channel_send.
bpo-26407: Unexpected errors in calling the
__iter__method are no longer masked byTypeErrorincsv.reader(),csv.writer.writerow()andcsv.writer.writerows().bpo-38488: Update ensurepip to install pip 20.1.1 and setuptools 47.1.0.
bpo-36543: Restored the deprecated
xml.etree.cElementTreemodule.bpo-34226: Fix
cgi.parse_multipartwithout content_length. Patch by Roger Duran
Tests¶
bpo-41085: Fix integer overflow in the
array.array.index()method on 64-bit Windows for index larger than2**31.bpo-41069:
test.support.TESTFNand the current directory for tests when run viatest.regrtestcontain now non-ascii characters if possible.bpo-38377: On Linux, skip tests using multiprocessing if the current user cannot create a file in
/dev/shm/directory. Add theskip_if_broken_multiprocessing_synchronize()function to thetest.supportmodule.bpo-41009: Fix use of
support.require_{linux|mac|freebsd}_version()decorators as class decorator.bpo-41003: Fix
test_copyregwhennumpyis installed:test.pickletesternow saves/restores warnings filters when importingnumpy, to ignore filters installed bynumpy.bpo-40964: Disable remote
imaplibtests, host cyrus.andrew.cmu.edu is blocking incoming connections.bpo-40927: Fix test_binhex when run twice: it now uses import_fresh_module() to ensure that it raises DeprecationWarning each time.
bpo-34401: Make test_gdb properly run on HP-UX. Patch by Michael Osipov.
Build¶
bpo-40204: Pin Sphinx version to 2.3.1 in
Doc/Makefile.
Windows¶
bpo-41074: Fixed support of non-ASCII names in functions
msilib.OpenDatabase()andmsilib.init_database()and non-ASCII SQL in methodmsilib.Database.OpenView().bpo-40164: Updates Windows OpenSSL to 1.1.1g
bpo-37556: Extend py.exe help to mention overrides via venv, shebang, environmental variables & ini files.
macOS¶
bpo-39580: Avoid opening Finder window if running installer from the command line. Patch contributed by Rick Heil.
bpo-41100: Fix configure error when building on macOS 11. Note that the current Python release was released shortly after the first developer preview of macOS 11 (Big Sur); there are other known issues with building and running on the developer preview. Big Sur is expected to be fully supported in a future bugfix release of Python 3.8.x and with 3.9.0.
bpo-41005: fixed an XDG settings issue not allowing macos to open browser in webbrowser.py
IDLE¶
C API¶
bpo-36346: Mark
Py_UNICODE_COPY,Py_UNICODE_FILL,PyUnicode_WSTR_LENGTH,PyUnicode_FromUnicode,PyUnicode_AsUnicode,_PyUnicode_AsUnicode, andPyUnicode_AsUnicodeAndSizeas deprecated in C. RemovePy_UNICODE_MATCHwhich was deprecated and broken since Python 3.3.bpo-36020: On Windows,
#include "pyerrors.h"no longer definessnprintfandvsnprintfmacros.bpo-40703: The PyType_FromSpec*() functions no longer overwrite the type’s “__module__” attribute if it is set via “Py_tp_members” or “Py_tp_getset”.
Python 3.9.0 beta 3¶
Release date: 2020-06-09
Library¶
bpo-40924:
importlib.resources: RevertedTraversableResourcesimplementations from the built-in loaders (SourceFileLoader and ZipImporter) as it was an incompatible change introduced in 3.9.0 beta 2 causing through a chain of events for root TLS certificates to be missing.
Build¶
bpo-40684:
make installnow uses thePLATLIBDIRvariable for the destinationlib-dynload/directory when./configure --with-platlibdiris used.
Python 3.9.0 beta 2¶
Release date: 2020-06-08
Core and Builtins¶
bpo-40904: Fix possible segfault in the new PEG parser when parsing f-string containing yield statements with no value (
f"{yield}"). Patch by Pablo Galindobpo-40903: Fixed a possible segfault in the new PEG parser when producing error messages for invalid assignments of the form
p=p=. Patch by Pablo Galindobpo-40880: Fix invalid memory read in the new parser when checking newlines in string literals. Patch by Pablo Galindo.
bpo-40883: Fix memory leak in when parsing f-strings in the new parser. Patch by Pablo Galindo
bpo-40870: Raise
ValueErrorwhen validating custom AST’s where the constantsTrue,FalseandNoneare used within aast.Namenode.bpo-40854: Allow overriding
sys.platlibdirvia a newPYTHONPLATLIBDIRenvironment variable.bpo-40826: Fix GIL usage in
PyOS_Readline(): lock the GIL to set an exception and pass the Python thread state when checking if there is a pending signal.bpo-40780: Fix a corner case where g-style string formatting of a float failed to remove trailing zeros.
bpo-38964: When there’s a
SyntaxErrorin the expression part of an fstring, the filename attribute of theSyntaxErrorgets correctly set to the name of the file the fstring resides in.bpo-40750: Support the “-d” debug flag in the new PEG parser. Patch by Pablo Galindo
bpo-40217: Instances of types created with
PyType_FromSpecWithBases()will no longer automatically visit their class object when traversing references in the garbage collector. The user is expected to manually visit the object’s class. Patch by Pablo Galindo.bpo-40696: Fix a hang that can arise after
generator.throw()due to a cycle in the exception context chain.
Library¶
bpo-39791: Refresh importlib.metadata from importlib_metadata 1.6.1.
bpo-40807: Stop codeop._maybe_compile, used by code.InteractiveInterpreter (and IDLE). from from emitting each warning three times.
bpo-39791: Built-in loaders (SourceFileLoader and ZipImporter) now supply
TraversableResourcesimplementations forResourceReader, and the fallback function has been removed.bpo-17005: The topological sort functionality that was introduced initially in the
functoolsmodule has been moved to a newgraphlibmodule to better accommodate the new tools and keep the original scope of thefunctoolsmodule. Patch by Pablo Galindobpo-40777: Initialize PyDateTime_IsoCalendarDateType.tp_base at run-time to avoid errors on some compilers.
bpo-40767:
webbrowsernow properly finds the default browser in pure Wayland systems by checking the WAYLAND_DISPLAY environment variable. Patch contributed by Jérémy Attali.bpo-40791:
hashlib.compare_digest()uses OpenSSL’sCRYPTO_memcmp()function when OpenSSL is available.bpo-40795:
ctypesmodule: If ctypes fails to convert the result of a callback or if a ctypes callback function raises an exception, sys.unraisablehook is now called with an exception set. Previously, the error was logged into stderr byPyErr_Print().bpo-30008: Fix
sslcode to be compatible with OpenSSL 1.1.x builds that useno-deprecatedand--api=1.1.0.bpo-30064: Fix asyncio
loop.sock_*race condition issuebpo-40737: Fix possible reference leak for
sqlite3initialization.bpo-40698:
distutilsupload creates SHA2-256 and Blake2b-256 digests. MD5 digests is skipped if platform blocks MD5.bpo-40695:
hashlibno longer falls back to builtin hash implementations when OpenSSL provides a hash digest and the algorithm is blocked by security policy.bpo-9216: func:
hashlib.newpassedusedforsecurityto OpenSSL EVP constructor_hashlib.new(). test_hashlib and test_smtplib handle strict security policy better.bpo-40614:
ast.parse()will not parse self documenting expressions in f-strings when passedfeature_versionis less than(3, 8).bpo-40671: Prepare
_hashlibfor PEP 489 and usePyModule_AddType().bpo-32309: Added a new coroutine
asyncio.to_thread(). It is mainly used for running IO-bound functions in a separate thread to avoid blocking the event loop, and essentially works as a high-level version ofrun_in_executor()that can directly take keyword arguments.bpo-40630: Added
tracemalloc.reset_peak()to set the peak size of traced memory blocks to the current size, to measure the peak of specific pieces of code.bpo-13097:
ctypesnow raises anArgumentErrorwhen a callback is invoked with more than 1024 arguments.bpo-23082: Updated the error message and docs of PurePath.relative_to() to better reflect the function behaviour.
bpo-39244: Fixed
multiprocessing.context.get_all_start_methodsto properly return the default method first on macOS.bpo-39040: Fix parsing of invalid mime headers parameters by collapsing whitespace between encoded words in a bare-quote-string.
bpo-35714:
struct.erroris now raised if there is a null character in astructformat string.bpo-36290: AST nodes are now raising
TypeErroron conflicting keyword arguments. Patch contributed by Rémi Lapeyre.
Tests¶
bpo-17258: Skip some
multiprocessingtests when MD5 hash digest is blocked.
Build¶
Windows¶
macOS¶
bpo-40741: Update macOS installer to use SQLite 3.32.2.
IDLE¶
C API¶
bpo-40910: Export explicitly the
Py_GetArgcArgv()function to the C API and document the function. Previously, it was exported implicitly which no longer works since Python is built with-fvisibility=hidden.bpo-40724: Allow defining buffer slots in type specs.
bpo-40826:
PyOS_InterruptOccurred()now fails with a fatal error if it is called with the GIL released.
Python 3.9.0 beta 1¶
Release date: 2020-05-19
Security¶
Core and Builtins¶
bpo-40663: Correctly generate annotations where parentheses are omitted but required (e.g:
Type[(str, int, *other))].bpo-40596: Fixed
str.isidentifier()for non-canonicalized strings containing non-BMP characters on Windows.bpo-40593: Improved syntax errors for invalid characters in source code.
bpo-40585: Fixed a bug when using
codeop.compile_command()that was causing exceptions to be swallowed with the new parser. Patch by Pablo Galindobpo-40502: Initialize
n->n_col_offset. (Patch by Joannah Nanjekye)bpo-40527: Fix command line argument parsing: no longer write errors multiple times into stderr.
bpo-1635741: Port
errnoto multiphase initialization (PEP 489).bpo-40523: Add pass-throughs for
hash()andreversed()toweakref.proxyobjects. Patch by Pablo Galindo.bpo-1635741: Port
syslogto multiphase initialization (PEP 489).bpo-40246: Reporting a specialised error message for invalid string prefixes, which was introduced in bpo-40246, is being reverted due to backwards compatibility concerns for strings that immediately follow a reserved keyword without whitespace between them. Constructs like
bg="#d00" if clear else"#fca"were failing to parse, which is not an acceptable breakage on such short notice.bpo-40417: Fix imp module deprecation warning when PyImport_ReloadModule is called. Patch by Robert Rouhani.
bpo-40408: Fixed support of nested type variables in GenericAlias (e.g.
list[list[T]]).bpo-1635741: Port _stat module to multiphase initialization (PEP 489).
bpo-29587: Enable implicit exception chaining when calling
generator.throw().bpo-40328: Add tools for generating mappings headers for CJKCodecs.
bpo-40228: Setting frame.f_lineno is now robust w.r.t. changes in the source-to-bytecode compiler
bpo-38880: Added the ability to list interpreters associated with channel ends in the internal subinterpreters module.
bpo-37986: Improve performance of
PyLong_FromDouble()for values that fit intolong.
Library¶
bpo-40662: Fixed
ast.get_source_segment()for ast nodes that have incomplete location information. Patch by Irit Katriel.bpo-40536: Added the
available_timezones()function to thezoneinfomodule. Patch by Paul Ganssle.bpo-40645: The
hmac.HMACexposes internal implementation details. The attributesdigest_cons,inner, andouterare deprecated and will be removed in the future.bpo-40645: The internal module
_hashlibwraps and exposes OpenSSL’s HMAC API. The new code will be used in Python 3.10 after the internal implementation details of the pure Python HMAC module are no longer part of the public API.bpo-40637: Builtin hash modules can now be disabled or selectively enabled with
configure --with-builtin-hashlib-hashes=sha3,blake1or--without-builtin-hashlib-hashes.bpo-37630: The
hashlibmodule can now use SHA3 hashes and SHAKE XOF from OpenSSL when available.bpo-40479: The
hashlibnow compiles with OpenSSL 3.0.0-alpha2.bpo-40257: Revert changes to
inspect.getdoc().bpo-40607: When cancelling a task due to timeout,
asyncio.wait_for()will now propagate the exception if an error happens during cancellation. Patch by Roman Skurikhin.bpo-40612: Fix edge cases in SyntaxError formatting. If the offset is <= 0, no caret is printed. If the offset is > line length, the caret is printed pointing just after the last character.
bpo-40597: If text content lines are longer than policy.max_line_length, always use a content-encoding to make sure they are wrapped.
bpo-40571: Added functools.cache() as a simpler, more discoverable way to access the unbounded cache variant of lru_cache(maxsize=None).
bpo-40503: PEP 615, the
zoneinfomodule. Adds support for the IANA time zone database.bpo-40397: Removed attributes
__args__and__parameters__from special generic aliases liketyping.List(not subscripted).bpo-40549: Convert posixmodule.c (“posix” or “nt” module) to the multiphase initialization (PEP 489).
bpo-31033: Add a
msgargument toFuture.cancel()andTask.cancel().bpo-40541: Added an optional counts parameter to random.sample().
bpo-40515: The
sslandhashlibmodules now actively check that OpenSSL is build with thread support. Python 3.7.0 made thread support mandatory and no longer works safely with a no-thread builds.bpo-31033: When a
asyncio.Taskis cancelled, the exception traceback now chains all the way back to where the task was first interrupted.bpo-40504:
functools.lru_cache()objects can now be the targets of weakrefs.bpo-40559: Fix possible memory leak in the C implementation of
asyncio.Task.bpo-40480:
fnmatch.fnmatch()could take exponential time in the presence of multiple*pattern characters. This was repaired by generating more elaborate regular expressions to avoid futile backtracking.bpo-40495:
compileallis now able to use hardlinks to prevent duplicates in a case when.pycfiles for different optimization levels have the same content.bpo-40457: The ssl module now support OpenSSL builds without TLS 1.0 and 1.1 methods.
bpo-40355: Improve error reporting in
ast.literal_eval()in the presence of malformedast.Dictnodes instead of silently ignoring any non-conforming elements. Patch by Curtis Bucher.bpo-40465: Deprecated the optional random argument to random.shuffle().
bpo-40459:
platform.win32_ver()now produces correct ptype strings instead of empty strings.bpo-39435: The first argument of
pickle.loads()is now positional-only.bpo-39305: Update
nntplibto mergenntplib.NNTPandnntplib._NNTPBase. Patch by Dong-hee Na.bpo-32494: Update
dbm.gnuto use gdbm_count if possible when callinglen(). Patch by Dong-hee Na.bpo-40453: Add
isolated=Truekeyword-only parameter to_xxsubinterpreters.create(). An isolated subinterpreter cannot spawn threads, spawn a child process or callos.fork().bpo-40286: Remove
_random.Random.randbytes(): the C implementation ofrandbytes(). Implement the method in Python to ease subclassing:randbytes()now directly reusesgetrandbits().bpo-40394: Added default arguments to
difflib.SequenceMatcher.find_longest_match().bpo-39995: Fix a race condition in concurrent.futures._ThreadWakeup: access to _ThreadWakeup is now protected with the shutdown lock.
bpo-30966:
Process.shutdown(wait=True)ofconcurrent.futuresnow closes explicitly the result queue.bpo-30966: Add a new
close()method to theSimpleQueueclass to explicitly close the queue.bpo-39966: Revert bpo-25597.
unittest.mock.MagicMockwith wraps’ set uses default return values for magic methods.bpo-39791: Added
files()function to importlib.resources with support for subdirectories in package data, matching backport in importlib_resources 1.5.bpo-40375:
imaplib.IMAP4.unselect()is added. Patch by Dong-hee Na.bpo-40389:
repr()now returnstyping.Optional[T]when called fortyping.Unionof two types, one of which isNoneType.bpo-40291: Add support for CAN_J1939 sockets (available on Linux 5.4+)
bpo-40273:
types.MappingProxyTypeis now reversible.bpo-39075: The repr for
types.SimpleNamespaceis now insertion ordered rather than alphabetical.bpo-40192: On AIX,
thread_time()is now implemented withthread_cputime()which has nanosecond resolution, rather thanclock_gettime(CLOCK_THREAD_CPUTIME_ID)which has a resolution of 10 ms. Patch by Batuhan Taskaya.bpo-40025: Raise TypeError when _generate_next_value_ is defined after members. Patch by Ethan Onstott.
bpo-39058: In the argparse module, the repr for Namespace() and other argument holders now displayed in the order attributes were added. Formerly, it displayed in alphabetical order even though argument order is preserved the user visible parts of the module.
bpo-24416: The
isocalendar()methods ofdatetime.dateanddatetime.datetimenow return a named tuple instead of atuple.
Documentation¶
bpo-34790: Add version of removal for explicit passing of coros to
asyncio.wait()’s documentationbpo-40561: Provide docstrings for webbrowser open functions.
bpo-40499: Mention that
asyncio.wait()requires a non-empty set of awaitables.bpo-39705: Tutorial example for sorted() in the Loop Techniques section is given a better explanation. Also a new example is included to explain sorted()’s basic behavior.
bpo-39435: Fix an incorrect signature for
pickle.loads()in the docs
Tests¶
Build¶
Windows¶
bpo-40650: Include winsock2.h in pytime.c for timeval.
bpo-40458: Increase reserved stack space to prevent overflow crash on Windows.
bpo-39148: Add IPv6 support to
asynciodatagram endpoints in ProactorEventLoop. Change the raised exception for unknown address families to ValueError as it’s not coming from Windows API.
macOS¶
bpo-34956: When building Python on macOS from source,
_tkinternow links with non-system Tcl and Tk frameworks if they are installed in/Library/Frameworks, as had been the case on older releases of macOS. If a macOS SDK is explicitly configured, by using--enable-universalsdk=or-isysroot, only the SDK itself is searched. The default behavior can still be overridden with--with-tcltk-includesand--with-tcltk-libs.bpo-35569: Expose RFC 3542 IPv6 socket options.
Tools/Demos¶
bpo-40479: Update multissltest helper to test with latest OpenSSL 1.0.2, 1.1.0, 1.1.1, and 3.0.0-alpha.
bpo-40431: Fix a syntax typo in
turtledemothat now raises aSyntaxError.bpo-40163: Fix multissltest tool. OpenSSL has changed download URL for old releases. The multissltest tool now tries to download from current and old download URLs.
C API¶
bpo-39465: Remove the
_PyUnicode_ClearStaticStrings()function from the C API.bpo-38787: Add PyCFunction_CheckExact() macro for exact type checks now that we allow subtypes of PyCFunction, as well as PyCMethod_CheckExact() and PyCMethod_Check() for the new PyCMethod subtype.
bpo-40545: Declare
_PyErr_GetTopmostException()withPyAPI_FUNC()to properly export the function in the C API. The function remains private (_Py) prefix.bpo-40412: Nullify inittab_copy during finalization, preventing future interpreter initializations in an embedded situation from crashing. Patch by Gregory Szorc.
bpo-40429: The
PyThreadState_GetFrame()function now returns a strong reference to the frame.bpo-40428: Remove the following functions from the C API. Call
PyGC_Collect()explicitly to free all free lists.PyAsyncGen_ClearFreeLists()PyContext_ClearFreeList()PyDict_ClearFreeList()PyFloat_ClearFreeList()PyFrame_ClearFreeList()PyList_ClearFreeList()PySet_ClearFreeList()PyTuple_ClearFreeList()
bpo-40421: New
PyFrame_GetBack()function: get the frame next outer frame.bpo-40421: New
PyFrame_GetCode()function: return a borrowed reference to the frame code.bpo-40217: Ensure that instances of types created with
PyType_FromSpecWithBases()will visit its class object when traversing references in the garbage collector (implemented as an extension of the providedtp_traverse). Patch by Pablo Galindo.bpo-38787: Module C state is now accessible from C-defined heap type methods (PEP 573). Patch by Marcel Plch and Petr Viktorin.
Python 3.9.0 alpha 6¶
Release date: 2020-04-27
Security¶
bpo-40121: Fixes audit events raised on creating a new socket.
bpo-39073: Disallow CR or LF in email.headerregistry.Address arguments to guard against header injection attacks.
bpo-39503: CVE-2020-8492: The
AbstractBasicAuthHandlerclass of theurllib.requestmodule uses an inefficient regular expression which can be exploited by an attacker to cause a denial of service. Fix the regex to prevent the catastrophic backtracking. Vulnerability reported by Ben Caller and Matt Schwager.
Core and Builtins¶
bpo-40313: Improve the performance of bytes.hex().
bpo-40334: Switch to a new parser, based on PEG. For more details see PEP 617. To temporarily switch back to the old parser, use
-X oldparserorPYTHONOLDPARSER=1. In Python 3.10 we will remove the old parser completely, including theparsermodule (already deprecated) and anything that depends on it.bpo-40267: Fix the tokenizer to display the correct error message, when there is a SyntaxError on the last input character and no newline follows. It used to be
unexpected EOF while parsing, while it should beinvalid syntax.bpo-39522: Correctly unparse explicit
uprefix for strings when postponed evaluation for annotations activated. Patch by Batuhan Taskaya.bpo-40246: Report a specialized error message,
invalid string prefix, when the tokenizer encounters a string with an invalid prefix.bpo-40082: Fix the signal handler: it now always uses the main interpreter, rather than trying to get the current Python thread state.
bpo-37388: str.encode() and str.decode() no longer check the encoding and errors in development mode or in debug mode during Python finalization. The codecs machinery can no longer work on very late calls to str.encode() and str.decode().
bpo-40077: Fix possible refleaks in
_json, memo of PyScannerObject should be traversed.bpo-37207: Speed up calls to
dict()by using the PEP 590vectorcallcalling convention.bpo-40141: Add column and line information to
ast.keywordnodes. Patch by Pablo Galindo.bpo-1635741: Port
resourceto multiphase initialization (PEP 489).bpo-1635741: Port
mathto multiphase initialization (PEP 489).bpo-1635741: Port _uuid module to multiphase initialization (PEP 489).
bpo-40077: Convert json module to use
PyType_FromSpec().bpo-40067: Improve the error message for multiple star expressions in an assignment. Patch by Furkan Onder
bpo-1635741: Port _functools module to multiphase initialization (PEP 489). Patch by Paulo Henrique Silva.
bpo-1635741: Port operator module to multiphase initialization (PEP 489). Patch by Paulo Henrique Silva.
bpo-20526: Fix
PyThreadState_Clear().PyThreadState.frameis a borrowed reference, not a strong reference:PyThreadState_Clear()must not callPy_CLEAR(tstate->frame).bpo-1635741: Port time module to multiphase initialization (PEP 489). Patch by Paulo Henrique Silva.
bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489).
bpo-40020: Fix a leak and subsequent crash in parsetok.c caused by realloc misuse on a rare codepath.
bpo-39939: Added str.removeprefix and str.removesuffix methods and corresponding bytes, bytearray, and collections.UserString methods to remove affixes from a string if present. See PEP 616 for a full description. Patch by Dennis Sweeney.
bpo-39481: Implement PEP 585. This supports list[int], tuple[str, …] etc.
bpo-32894: Support unparsing of infinity numbers in postponed annotations. Patch by Batuhan Taşkaya.
bpo-37207: Speed up calls to
list()by using the PEP 590vectorcallcalling convention. Patch by Mark Shannon.
Library¶
bpo-40398:
typing.get_args()now always returns an empty tuple for special generic aliases.bpo-40396: Functions
typing.get_origin(),typing.get_args()andtyping.get_type_hints()support now generic aliases likelist[int].bpo-38061: Optimize the
subprocessmodule on FreeBSD usingclosefrom(). A singleclose(fd)syscall is cheap, but whensysconf(_SC_OPEN_MAX)is high, the loop callingclose(fd)on each file descriptor can take several milliseconds.The workaround on FreeBSD to improve performance was to load and mount the fdescfs kernel module, but this is not enabled by default.
Initial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans (kevans) and Kubilay Kocak (koobs): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274
bpo-38061: On FreeBSD,
os.closerange(fd_low, fd_high)now callsclosefrom(fd_low)if fd_high is greater than or equal tosysconf(_SC_OPEN_MAX).Initial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans (kevans) and Kubilay Kocak (koobs): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274
bpo-40360: The
lib2to3module is pending deprecation due to PEP 617.bpo-40138: Fix the Windows implementation of
os.waitpid()for exit code larger thanINT_MAX >> 8. The exit status is now interpreted as an unsigned number.bpo-39942: Set “__main__” as the default module name when “__name__” is missing in
typing.TypeVar. Patch by Weipeng Hong.bpo-40275: The
loggingpackage is now imported lazily inunittestonly when theassertLogs()assertion is used.bpo-40275: The
asynciopackage is now imported lazily inunittestonly when theIsolatedAsyncioTestCaseclass is used.bpo-40330: In
ShareableList.__setitem__(), check the size of a new string item after encoding it to utf-8, not before.bpo-40148: Added
pathlib.Path.with_stem()to create a new Path with the stem replaced.bpo-40325: Deprecated support for set objects in random.sample().
bpo-40257: Improved help for the
typingmodule. Docstrings are now shown for all special forms and special generic aliases (likeUnionandList). Usinghelp()with generic alias likeList[int]will show the help for the correspondent concrete type (listin this case).bpo-40257: func:
inspect.getdocno longer returns docstring inherited from the type of the object or from parent class if it is a class if it is not defined in the object itself. Inpydocthe documentation string is now shown not only for class, function, method etc, but for any object that has its own__doc__attribute.bpo-40287: Fixed
SpooledTemporaryFile.seek()to return the position.bpo-40290: Added zscore() to statistics.NormalDist().
bpo-40282: Allow
random.getrandbits(0)to succeed and to return 0.bpo-40286: Add
random.randbytes()function andrandom.Random.randbytes()method to generate random bytes.bpo-40277:
collections.namedtuple()now provides a human-readable repr for its field accessors.bpo-40270: The included copy of sqlite3 on Windows is now compiled with the json extension. This allows the use of functions such as
json_object.bpo-29255: Wait in
KqueueSelector.selectwhen no fds are registeredbpo-40260: Ensure
modulefinderusesio.open_code()and respects coding comments.bpo-40234: Allow again to spawn daemon threads in subinterpreters (revert change which denied them).
bpo-39207: Workers in
ProcessPoolExecutorare now spawned on demand, only when there are no available idle workers to reuse. This optimizes startup overhead and reduces the amount of lost CPU time to idle workers. Patch by Kyle Stanley.bpo-40091: Fix a hang at fork in the logging module: the new private _at_fork_reinit() method is now used to reinitialize locks at fork in the child process.
bpo-40149: Implement traverse and clear slots in _abc._abc_data type.
bpo-40208: Remove deprecated
symtable.SymbolTable.has_exec().bpo-40196: Fix a bug in the
symtablemodule that was causing incorrectly report global variables as local. Patch by Pablo Galindo.bpo-40190: Add support for
_SC_AIX_REALMEMtoposix.sysconf().bpo-40182: Removed the
_field_typesattribute of thetyping.NamedTupleclass.bpo-36517: Multiple inheritance with
typing.NamedTuplenow raises an error instead of silently ignoring other types.bpo-40126: Fixed reverting multiple patches in unittest.mock. Patcher’s
__exit__()is now never called if its__enter__()is failed. Returning true from__exit__()silences now the exception.bpo-40094: CGIHTTPRequestHandler of http.server now logs the CGI script exit code, rather than the CGI script exit status of os.waitpid(). For example, if the script is killed by signal 11, it now logs: “CGI script exit code -11.”
bpo-40108: Improve the error message when triying to import a module using
runpyand incorrently use the “.py” extension at the end of the module name. Patch by Pablo Galindo.bpo-40094: Add
os.waitstatus_to_exitcode()function: convert a wait status to an exit code.bpo-40089: Fix threading._after_fork(): if fork was not called by a thread spawned by threading.Thread, threading._after_fork() now creates a _MainThread instance for _main_thread, instead of a _DummyThread instance.
bpo-40089: Add a private
_at_fork_reinit()method to_thread.Lock,_thread.RLock,threading.RLockandthreading.Conditionclasses: reinitialize the lock at fork in the child process, reset the lock to the unlocked state. Rename also the private_reset_internal_locks()method ofthreading.Eventto_at_fork_reinit().bpo-25780: Expose
CAN_RAW_JOIN_FILTERSin thesocketmodule.bpo-39503:
AbstractBasicAuthHandlerofurllib.requestnow parses all WWW-Authenticate HTTP headers and accepts multiple challenges per header: use the realm of the first Basic challenge.bpo-39812: Removed daemon threads from
concurrent.futuresby adding an internalthreading._register_atexit(), which calls registered functions prior to joining all non-daemon threads. This allows for compatibility with subinterpreters, which don’t support daemon threads.bpo-40050: Fix
importlib._bootstrap_external: avoid creating a newwinregbuiltin module if it’s already available insys.modules, and remove redundant imports.bpo-40014: Fix
os.getgrouplist(): ifgetgrouplist()function fails because the group list is too small, retry with a larger group list. On failure, the glibc implementation ofgetgrouplist()setsngroupsto the total number of groups. For other implementations, double the group list size.bpo-40017: Add
time.CLOCK_TAIconstant if the operating system support it.bpo-40016: In re docstring, clarify the relationship between inline and argument compile flags.
bpo-39953: Update internal table of OpenSSL error codes in the
sslmodule.bpo-36144: Added PEP 584 operators to
weakref.WeakValueDictionary.bpo-36144: Added PEP 584 operators to
weakref.WeakKeyDictionary.bpo-38891: Fix linear runtime behaviour of the
__getitem__and__setitem__methods inmultiprocessing.shared_memory.ShareableList. This avoids quadratic performance when iterating aShareableList. Patch by Thomas Krennwallner.bpo-39682: Remove undocumented support for closing a
pathlib.Pathobject via its context manager. The context manager magic methods remain, but they are now a no-op, makingPathobjects immutable.bpo-36144: Added PEP 584 operators (
|and|=) tocollections.ChainMap.bpo-39011: Normalization of line endings in ElementTree attributes was removed, as line endings which were replaced by entity numbers should be preserved in original form.
bpo-38410: Properly handle
sys.audit()failures insys.set_asyncgen_hooks().bpo-36541: lib2to3 now recognizes named assignment expressions (the walrus operator,
:=)bpo-35967: In platform, delay the invocation of ‘uname -p’ until the processor attribute is requested.
bpo-35113:
inspect.getsource()now returns correct source code for inner class with same name as module level class. Decorators are also returned as part of source of the class. Patch by Karthikeyan Singaravelan.bpo-33262: Deprecate passing None as an argument for
shlex.split()’ssparameter. Patch by Zackery Spytz.bpo-31758: Prevent crashes when using an uninitialized
_elementtree.XMLParserobject. Patch by Oren Milman.
Documentation¶
bpo-27635: The pickle documentation incorrectly claimed that
__new__isn’t called by default when unpickling.bpo-39879: Updated Data model docs to include
dict()insertion order preservation. Patch by Furkan Onder and Samy Lahfa.bpo-38387: Document
PyDoc_STRVARmacro in the C-API reference.bpo-13743: Some methods within xml.dom.minidom.Element class are now better documented.
Tests¶
bpo-31904: Set expected default encoding in test_c_locale_coercion.py for VxWorks RTOS.
bpo-40162: Update Travis CI configuration to OpenSSL 1.1.1f.
bpo-40146: Update OpenSSL to 1.1.1f in Azure Pipelines.
bpo-40094: Add
test.support.wait_process()function.bpo-40003:
test.bisect_cmdnow copies Python command line options like-Oor-W. Moreover, emit a warning iftest.bisect_cmdis used with-w/--verbose2option.bpo-39380: Add the encoding in
ftplib.FTPandftplib.FTP_TLSto the constructor as keyword-only and change the default fromlatin-1toutf-8to follow RFC 2640.bpo-39793: Use the same domain when testing
make_msgid. Patch by Batuhan Taskaya.bpo-1812: Fix newline handling in doctest.testfile when loading from a package whose loader has a get_data method. Patch by Peter Donis.
Build¶
bpo-38360: Support single-argument form of macOS -isysroot flag.
bpo-40158: Fix CPython MSBuild Properties in NuGet Package (build/native/python.props)
bpo-38527: Fix configure check on Solaris for “float word ordering”: sometimes, the correct “grep” command was not being used. Patch by Arnon Yaari.
Windows¶
macOS¶
bpo-38329: python.org macOS installers now update the Current version symlink of /Library/Frameworks/Python.framework/Versions for 3.9 installs. Previously, Current was only updated for Python 2.x installs. This should make it easier to embed Python 3 into other macOS applications.
bpo-40164: Update macOS installer builds to use OpenSSL 1.1.1g.
IDLE¶
Tools/Demos¶
bpo-40385: Removed the checkpyc.py tool. Please see compileall without force mode as a potential alternative.
bpo-40179: Fixed translation of
#elifin Argument Clinic.bpo-40094: Fix
which.pyscript exit code: it now usesos.waitstatus_to_exitcode()to convertos.system()exit status into an exit code.
C API¶
bpo-40241: Move the
PyGC_Headstructure to the internal C API.bpo-40170: Convert
PyObject_IS_GC()macro to a function to hide implementation details.bpo-40241: Add the functions
PyObject_GC_IsTracked()andPyObject_GC_IsFinalized()to the public API to allow to query if Python objects are being currently tracked or have been already finalized by the garbage collector respectively. Patch by Pablo Galindo.bpo-40170: The
PyObject_NEW()macro becomes an alias to thePyObject_New()macro, and thePyObject_NEW_VAR()macro becomes an alias to thePyObject_NewVar()macro, to hide implementation details. They no longer access directly thePyTypeObject.tp_basicsizemember.bpo-40170:
PyType_HasFeature()now always callsPyType_GetFlags()to hide implementation details. Previously, it accessed directly thePyTypeObject.tp_flagsmember when the limited C API was not used.bpo-40170: Convert the
PyObject_GET_WEAKREFS_LISTPTR()macro to a function to hide implementation details: the macro accessed directly to thePyTypeObject.tp_weaklistoffsetmember.bpo-40170: Convert
PyObject_CheckBuffer()macro to a function to hide implementation details: the macro accessed directly thePyTypeObject.tp_as_buffermember.bpo-40170: Always declare
PyIndex_Check()as an opaque function to hide implementation details: removePyIndex_Check()macro. The macro accessed directly thePyTypeObject.tp_as_numbermember.bpo-39947: Add
PyThreadState_GetID()function: get the unique identifier of a Python thread state.
Python 3.9.0 alpha 5¶
Release date: 2020-03-23
Security¶
bpo-38576: Disallow control characters in hostnames in http.client, addressing CVE-2019-18348. Such potentially malicious header injection URLs now cause a InvalidURL to be raised.
Core and Builtins¶
bpo-40010: Optimize pending calls in multithreaded applications. If a thread different than the main thread schedules a pending call (
Py_AddPendingCall()), the bytecode evaluation loop is no longer interrupted at each bytecode instruction to check for pending calls which cannot be executed. Only the main thread can execute pending calls.Previously, the bytecode evaluation loop was interrupted at each instruction until the main thread executes pending calls.
bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489).
bpo-1635741: Port _collections module to multiphase initialization (PEP 489).
bpo-40010: Optimize signal handling in multithreaded applications. If a thread different than the main thread gets a signal, the bytecode evaluation loop is no longer interrupted at each bytecode instruction to check for pending signals which cannot be handled. Only the main thread of the main interpreter can handle signals.
Previously, the bytecode evaluation loop was interrupted at each instruction until the main thread handles signals.
bpo-39984: If
Py_AddPendingCall()is called in a subinterpreter, the function is now scheduled to be called from the subinterpreter, rather than being called from the main interpreter. Each subinterpreter now has its own list of scheduled calls.bpo-1635741: Port _heapq module to multiphase initialization.
bpo-1635741: Port itertools module to multiphase initialization (PEP 489).
bpo-37207: Speed up calls to
frozenset()by using the PEP 590vectorcallcalling convention. Patch by Dong-hee Na.bpo-39984: subinterpreters: Move
_PyRuntimeState.ceval.tracing_possibletoPyInterpreterState.ceval.tracing_possible: each interpreter now has its own variable.bpo-37207: Speed up calls to
set()by using the PEP 590vectorcallcalling convention. Patch by Dong-hee Na.bpo-1635741: Port _statistics module to multiphase initialization (PEP 489).
bpo-39968: Use inline function to replace extension modules’ get_module_state macros.
bpo-39965: Correctly raise
SyntaxErrorif await is used inside non-async functions andPyCF_ALLOW_TOP_LEVEL_AWAITis set (like in the asyncio REPL). Patch by Pablo Galindo.bpo-39562: Allow executing asynchronous comprehensions on the top level when the
PyCF_ALLOW_TOP_LEVEL_AWAITflag is given. Patch by Batuhan Taskaya.bpo-37207: Speed up calls to
tuple()by using the PEP 590vectorcallcalling convention. Patch by Dong-hee Na.bpo-38373: Chaged list overallocation strategy. It no longer overallocates if the new size is closer to overalocated size than to the old size and adds padding.
bpo-39926: Update Unicode database to Unicode version 13.0.0.
bpo-19466: Clear the frames of daemon threads earlier during the Python shutdown to call objects destructors. So “unclosed file” resource warnings are now emitted for daemon threads in a more reliable way.
bpo-38894: Fix a bug that was causing incomplete results when calling
pathlib.Path.globin the presence of symlinks that point to files where the user does not have read access. Patch by Pablo Galindo and Matt Wozniski.bpo-39877: Fix
PyEval_RestoreThread()random crash at exit with daemon threads. It now accesses the_PyRuntimevariable directly instead of usingtstate->interp->runtime, sincetstatecan be a dangling pointer afterPy_Finalize()has been called. Moreover, the daemon thread now exits before trying to take the GIL.bpo-39871: Fix a possible
SystemErrorinmath.{atan2,copysign,remainder}()when the first argument cannot be converted to afloat. Patch by Zackery Spytz.bpo-39776: Fix race condition where threads created by PyGILState_Ensure() could get a duplicate id.
This affects consumers of tstate->id like the contextvar caching machinery, which could return invalid cached objects under heavy thread load (observed in embedded scenarios).
bpo-39778: Fixed a crash due to incorrect handling of weak references in
collections.OrderedDictclasses. Patch by Pablo Galindo.bpo-1635741: Port audioop extension module to multiphase initialization (PEP 489).
bpo-39702: Relax decorator grammar restrictions to allow any valid expression (PEP 614).
bpo-38091: Tweak import deadlock detection code to not deadlock itself.
bpo-1635741: Port _locale extension module to multiphase initialization (PEP 489).
bpo-39087: Optimize
PyUnicode_AsUTF8()andPyUnicode_AsUTF8AndSize()slightly when they need to create internal UTF-8 cache.bpo-39520: Fix unparsing of ext slices with no items (
foo[:,]). Patch by Batuhan Taskaya.bpo-39220: Do not optimize annotations if ‘from __future__ import annotations’ is used. Patch by Pablo Galindo.
bpo-35712: Using
NotImplementedin a boolean context has been deprecated. Patch contributed by Josh Rosenberg.bpo-22490: Don’t leak environment variable
__PYVENV_LAUNCHER__into the interpreter session on macOS.
Library¶
bpo-39830: Add
zipfile.Pathto__all__in thezipfilemodule.bpo-40000: Improved error messages for validation of
ast.Constantnodes. Patch by Batuhan Taskaya.bpo-39999:
__module__of the AST node classes is now set to “ast” instead of “_ast”. Added docstrings for dummy AST node classes and deprecated attributes.bpo-39991:
uuid.getnode()now skips IPv6 addresses with the same string length than a MAC address (17 characters): only use MAC addresses.bpo-39988: Deprecated
ast.AugLoadandast.AugStorenode classes because they are no longer used.bpo-39656: Ensure
bin/python3.#is always present in virtual environments on POSIX platforms - by Anthony Sottile.bpo-39969: Deprecated
ast.Paramnode class because it’s no longer used. Patch by Batuhan Taskaya.bpo-39360: Ensure all workers exit when finalizing a
multiprocessing.Poolimplicitly via the module finalization handlers of multiprocessing. This fixes a deadlock situation that can be experienced when the Pool is not properly finalized via the context manager or a call tomultiprocessing.Pool.terminate. Patch by Batuhan Taskaya and Pablo Galindo.bpo-35370: sys.settrace(), sys.setprofile() and _lsprof.Profiler.enable() now properly report
PySys_Audit()error if “sys.setprofile” or “sys.settrace” audit event is denied.bpo-39936: AIX: Fix _aix_support module when the subprocess is not available, when building Python from scratch. It now uses new private _bootsubprocess module, rather than having two implementations depending if subprocess is available or not. So _aix_support.aix_platform() result is now the same if subprocess is available or not.
bpo-36144:
collections.OrderedDictnow implements|and|=(PEP 584).bpo-39652: The column name found in
sqlite3.Cursor.descriptionis now truncated on the first ‘[’ only if the PARSE_COLNAMES option is set.bpo-39915: Ensure
unittest.mock.AsyncMock.await_args_listhas call objects in the order of awaited arguments instead of usingunittest.mock.Mock.call_argswhich has the last value of the call. Patch by Karthikeyan Singaravelan.bpo-36144: Updated
os.environandos.environbto support PEP 584’s merge (|) and update (|=) operators.bpo-38662: The
ensurepipmodule now invokespipvia therunpymodule. Hence it is no longer tightly coupled with the internal API of the bundledpipversion, allowing easier updates to a newerpipversion both internally and for distributors.bpo-38075: Fix the
random.Random.seed()method when aboolis passed as the seed.bpo-39916: More reliable use of
os.scandir()inPath.glob(). It no longer emits a ResourceWarning when interrupted.bpo-39850:
multiprocessingnow supports abstract socket addresses (if abstract sockets are supported in the running platform). When creating arbitrary addresses (like when default-constructingmultiprocessing.connection.Listenerobjects) abstract sockets are preferred to avoid the case when the temporary-file-generated address is too large for an AF_UNIX socket address. Patch by Pablo Galindo.bpo-36287:
ast.dump()no longer outputs optional fields and attributes with default values. The default values for optional fields and attributes of AST nodes are now set as class attributes (e.g.Constant.kindis set toNone).bpo-39889: Fixed
ast.unparse()for extended slices containing a single element (e.g.a[i:j,]). Remove redundant tuples when index with a tuple (e.g.a[i, j]).bpo-39828: Fix
json.toolto catchBrokenPipeError. Patch by Dong-hee Na.bpo-13487: Avoid a possible “RuntimeError: dictionary changed size during iteration” from
inspect.getmodule()when it tried to loop throughsys.modules.bpo-39674: Revert “bpo-37330: open() no longer accept ‘U’ in file mode”. The “U” mode of open() is kept in Python 3.9 to ease transition from Python 2.7, but will be removed in Python 3.10.
bpo-28577: The hosts method on 32-bit prefix length IPv4Networks and 128-bit prefix IPv6Networks now returns a list containing the single Address instead of an empty list.
bpo-39826: Add getConnection method to logging HTTPHandler to enable custom connections.
bpo-39763: Reimplement
distutils.spawn.spawn()function with thesubprocessmodule.bpo-39794: Add –without-decimal-contextvar build option. This enables a thread-local rather than a coroutine local context.
bpo-36144:
collections.defaultdictnow implements|(PEP 584).bpo-39517: Fix runpy.run_path() when using pathlike objects
bpo-39775: Change
inspect.Signature.parametersback tocollections.OrderedDict. This was changed todictin Python 3.9.0a4.bpo-39678: Refactor queue_manager in
concurrent.futures.ProcessPoolExecutorto make it easier to maintain.bpo-39764: Fix AttributeError when calling get_stack on a PyAsyncGenObject Task
bpo-39769: The
compileall.compile_dir()function’s ddir parameter and the compileall command line flag-dno longer write the wrong pathname to the generated pyc file for submodules beneath the root of the directory tree being compiled. This fixes a regression introduced with Python 3.5.bpo-36144:
types.MappingProxyTypeobjects now support the merge (|) operator from PEP 584.bpo-38691: The
importlibmodule now ignores thePYTHONCASEOKenvironment variable when the-Eor-Icommand line options are being used.bpo-39719: Remove
tempfile.SpooledTemporaryFile.softspace()as files no longer have thesoftspaceattribute in Python 3. Patch by Shantanu.bpo-39667: Improve pathlib.Path compatibility on zipfile.Path and correct performance degradation as found in zipp 3.0.
bpo-39638: Keep ASDL signatures in the docstrings for
ASTnodes. Patch by Batuhan Taskayabpo-39639: Deprecated
ast.Suitenode class because it’s no longer used. Patch by Batuhan Taskaya.bpo-39609: Add thread_name_prefix to default asyncio executor
bpo-39548: Fix handling of header in
urllib.request.AbstractDigestAuthHandlerwhen the optionalqopparameter is not present.bpo-39509: HTTP status codes
103 EARLY_HINTSand425 TOO_EARLYare added tohttp.HTTPStatus. Patch by Dong-hee Na.bpo-39507: Adding HTTP status 418 “I’m a Teapot” to HTTPStatus in http library. Patch by Ross Rhodes.
bpo-39495: Remove default value from attrs parameter of
xml.etree.ElementTree.TreeBuilder.start()for consistency between Python and C implementations.bpo-38971: Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised.
bpo-38641: Added starred expressions support to
returnandyieldstatements forlib2to3. Patch by Vlad Emelianov.bpo-37534: When using minidom module to generate XML documents the ability to add Standalone Document Declaration is added. All the changes are made to generate a document in compliance with Extensible Markup Language (XML) 1.0 (Fifth Edition) W3C Recommendation (available here: https://www.w3.org/TR/xml/#sec-prolog-dtd).
bpo-34788: Add support for scoped IPv6 addresses to
ipaddress. Patch by Oleksandr Pavliuk.bpo-34822: Simplified AST for subscription. Simple indices are now represented by their value, extended slices are represented as tuples.
astclassesIndexandExtSliceare considered deprecated and will be removed in future Python versions. In the meantime,Index(value)now returns avalueitself,ExtSlice(slices)returnsTuple(slices, Load()).
Documentation¶
bpo-13790: Change ‘string’ to ‘specification’ in format doc.
bpo-17422: The language reference no longer restricts default class namespaces to dicts only.
bpo-39530: Fix misleading documentation about mixed-type numeric comparisons.
bpo-39718: Update
tokendocumentation to reflect additions in Python 3.8bpo-39677: Changed operand name of MAKE_FUNCTION from argc to flags for module
dis
Tests¶
bpo-40019: test_gdb now skips tests if it detects that gdb failed to read debug information because the Python binary is optimized.
bpo-27807:
test_site.test_startup_imports()is now skipped if a path ofsys.pathcontains a.pthfile.bpo-26067: Do not fail test_shutil test_chown test when uid or gid of user cannot be resolved to a name.
bpo-39855: test_subprocess.test_user() now skips the test on an user name if the user name doesn’t exist. For example, skip the test if the user “nobody” doesn’t exist on Linux.
Build¶
bpo-39761: Fix build with DTrace but without additional DFLAGS.
bpo-39763: setup.py now uses a basic implementation of the
subprocessmodule if thesubprocessmodule is not available: before required C extension modules are built.bpo-1294959: Add
--with-platlibdiroption to the configure script: name of the platform-specific library directory, stored in the newsys.platlibdirattribute. It is used to build the path of platform-specific extension modules and the path of the standard library. It is equal to"lib"on most platforms. On Fedora and SuSE, it is equal to"lib64"on 64-bit platforms. Patch by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor Stinner.
Windows¶
bpo-39930: Ensures the required
vcruntime140.dllis included in install packages.bpo-39847: Avoid hang when computer is hibernated whilst waiting for a mutex (for lock-related objects from
threading) around 49-day uptime.bpo-38597:
distutilswill no longer statically linkvcruntime140.dllwhen a redistributable version is unavailable. All future releases of CPython will include a copy of this DLL to ensure distributed extensions can continue to load.bpo-38380: Update Windows builds to use SQLite 3.31.1
bpo-39789: Update Windows release build machines to Visual Studio 2019 (MSVC 14.2).
bpo-34803: Package for nuget.org now includes repository reference and bundled icon image.
macOS¶
bpo-38380: Update macOS builds to use SQLite 3.31.1
IDLE¶
bpo-27115: For ‘Go to Line’, use a Query box subclass with IDLE standard behavior and improved error checking.
bpo-39885: Since clicking to get an IDLE context menu moves the cursor, any text selection should be and now is cleared.
bpo-39852: Edit “Go to line” now clears any selection, preventing accidental deletion. It also updates Ln and Col on the status bar.
bpo-39781: Selecting code context lines no longer causes a jump.
Tools/Demos¶
bpo-36184: Port python-gdb.py to FreeBSD. python-gdb.py now checks for “take_gil” function name to check if a frame tries to acquire the GIL, instead of checking for “pthread_cond_timedwait” which is specific to Linux and can be a different condition than the GIL.
bpo-38080: Added support to fix
getproxiesin thelib2to3.fixes.fix_urllibmodule. Patch by José Roberto Meza Cabrera.
C API¶
bpo-40024: Add
PyModule_AddType()helper function: add a type to a module. Patch by Dong-hee Na.bpo-39946: Remove
_PyRuntime.getframehook and remove_PyThreadState_GetFramemacro which was an alias to_PyRuntime.getframe. They were only exposed by the internal C API. Remove alsoPyThreadFrameGettertype.bpo-39947: Add
PyThreadState_GetFrame()function: get the current frame of a Python thread state.bpo-37207: Add _PyArg_NoKwnames helper function. Patch by Dong-hee Na.
bpo-39947: Add
PyThreadState_GetInterpreter(): get the interpreter of a Python thread state.bpo-39947: Add
PyInterpreterState_Get()function to the limited C API.bpo-35370: If
PySys_Audit()fails inPyEval_SetProfile()orPyEval_SetTrace(), log the error as an unraisable exception.bpo-39947: Move the static inline function flavor of Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() to the internal C API: they access PyThreadState attributes. The limited C API provides regular functions which hide implementation details.
bpo-39947: Py_TRASHCAN_BEGIN_CONDITION and Py_TRASHCAN_END macro no longer access PyThreadState attributes, but call new private _PyTrash_begin() and _PyTrash_end() functions which hide implementation details.
bpo-39884:
PyDescr_NewMethod()andPyCFunction_NewEx()now include the method name in the SystemError “bad call flags” error message to ease debug.bpo-39877: Deprecated
PyEval_InitThreads()andPyEval_ThreadsInitialized(). CallingPyEval_InitThreads()now does nothing.bpo-38249:
Py_UNREACHABLEis now implemented with__builtin_unreachable()and analogs in release mode.bpo-38643:
PyNumber_ToBase()now raises aSystemErrorinstead of crashing when called with invalid base.bpo-39882: The
Py_FatalError()function is replaced with a macro which logs automatically the name of the current function, unless thePy_LIMITED_APImacro is defined.bpo-39824: Extension modules:
m_traverse,m_clearandm_freefunctions ofPyModuleDefare no longer called if the module state was requested but is not allocated yet. This is the case immediately after the module is created and before the module is executed (Py_mod_execfunction). More precisely, these functions are not called ifm_sizeis greater than 0 and the module state (as returned byPyModule_GetState()) isNULL.Extension modules without module state (
m_size <= 0) are not affected.bpo-38913: Fixed segfault in
Py_BuildValue()called with a format containing “#” and undefined PY_SSIZE_T_CLEAN whwn an exception is set.bpo-38500: Add a private API to get and set the frame evaluation function: add
_PyInterpreterState_GetEvalFrameFunc()and_PyInterpreterState_SetEvalFrameFunc()C functions. The_PyFrameEvalFunctionfunction type now takes a tstate parameter.
Python 3.9.0 alpha 4¶
Release date: 2020-02-25
Security¶
Core and Builtins¶
bpo-39382: Fix a use-after-free in the single inheritance path of
issubclass(), when the__bases__of an object has a single reference, and so does its first item. Patch by Yonatan Goldschmidt.bpo-39573: Update clinic tool to use
Py_IS_TYPE(). Patch by Dong-hee Na.bpo-39619: Enable use of
os.chroot()on HP-UX systems.bpo-39573: Add
Py_IS_TYPE()static inline function to check whether the object o type is type.bpo-39606: Fix regression caused by fix for bpo-39386, that prevented calling
acloseon an async generator that had already been closed or exhausted.bpo-39579: Change the ending column offset of
Attributenodes constructed inast_for_dotted_nameto point at the end of the current node and not at the end of the lastNAMEnode.bpo-1635741: Port _crypt extension module to multiphase initialization (PEP 489).
bpo-1635741: Port _contextvars extension module to multiphase initialization (PEP 489).
bpo-39510: Fix segfault in
readinto()method on closed BufferedReader.bpo-39502: Fix
time.localtime()on 64-bit AIX to support years before 1902 and after 2038. Patch by M Felt.bpo-39492: Fix a reference cycle in the C Pickler that was preventing the garbage collection of deleted, pickled objects.
bpo-39453: Fixed a possible crash in
list.__contains__()when a list is changed during comparing items. Patch by Dong-hee Na.bpo-39434: floor division of float operation now has a better performance. Also the message of
ZeroDivisionErrorfor this operation is updated. Patch by Dong-hee Na.bpo-1635741: Port _codecs extension module to multiphase initialization (PEP 489).
bpo-1635741: Port _bz2 extension module to multiphase initialization (PEP 489).
bpo-1635741: Port _abc extension module to multiphase initialization (PEP 489).
bpo-39320: Replace two complex bytecodes for building dicts with two simpler ones. The new bytecodes
DICT_MERGEandDICT_UPDATEhave been added The old bytecodesBUILD_MAP_UNPACKandBUILD_MAP_UNPACK_WITH_CALLhave been removed.bpo-39219: Syntax errors raised in the tokenizer now always set correct “text” and “offset” attributes.
bpo-36051: Drop the GIL during large
bytes.joinoperations. Patch by Bruce Merry.bpo-38960: Fix DTrace build issues on FreeBSD. Patch by David Carlier.
bpo-37207: Speed up calls to
range()by about 30%, by using the PEP 590vectorcallcalling convention. Patch by Mark Shannon.bpo-36144:
dict(andcollections.UserDict) objects now support PEP 584’s merge (|) and update (|=) operators. Patch by Brandt Bucher.bpo-32856: Optimized the idiom for assignment a temporary variable in comprehensions. Now
for y in [expr]in comprehensions is as fast as a simple assignmenty = expr.
Library¶
bpo-30566: Fix
IndexErrorwhen trying to decode an invalid string with punycode codec.bpo-39649: Remove obsolete check for
__args__in bdb.Bdb.format_stack_entry.bpo-39648: Expanded
math.gcd()andmath.lcm()to handle multiple arguments.bpo-39681: Fix a regression where the C pickle module wouldn’t allow unpickling from a file-like object that doesn’t expose a readinto() method.
bpo-35950: Raise
io.UnsupportedOperationinio.BufferedReader.truncate()when it is called on a read-onlyio.BufferedReaderinstance.bpo-39479: Add
math.lcm()function: least common multiple.bpo-39674: Revert “Do not expose abstract collection classes in the collections module” change (bpo-25988). Aliases to ABC like collections.Mapping are kept in Python 3.9 to ease transition from Python 2.7, but will be removed in Python 3.10.
bpo-39104: Fix hanging ProcessPoolExcutor on
shutdown(wait=False)when a task has failed pickling.bpo-39627: Fixed TypedDict totality check for inherited keys.
bpo-39474: Fixed starting position of AST for expressions like
(a)(b),(a)[b]and(a).b.bpo-21016: The
pydocandtracemodules now use thesysconfigmodule to get the path to the Python standard library, to support uncommon installation path like/usr/lib64/python3.9/on Fedora. Patch by Jan Matějek.bpo-39590: Collections.deque now holds strong references during deque.__contains__ and deque.count, fixing crashes.
bpo-39586: The distutils
bdist_msicommand is deprecated in Python 3.9, usebdist_wheel(wheel packages) instead.bpo-39595: Improved performance of zipfile.Path for files with a large number of entries. Also improved performance and fixed minor issue as published with importlib_metadata 1.5.
bpo-39350: Fix regression in
fractions.Fractionif the numerator and/or the denominator is anintsubclass. Themath.gcd()function is now used to normalize the numerator and denominator.math.gcd()always return ainttype. Previously, the GCD type depended on numerator and denominator.bpo-39567: Added audit for
os.walk(),os.fwalk(),pathlib.Path.glob()andpathlib.Path.rglob().bpo-39559: Remove unused, undocumented argument
gettersfromuuid.getnode()bpo-38149:
sys.audit()is now called only once per call ofglob.glob()andglob.iglob().bpo-39546: Fix a regression in
ArgumentParserwhereallow_abbrev=Falsewas ignored for long options that used a prefix character other than “-“.bpo-39450: Striped whitespace from docstring before returning it from
unittest.case.shortDescription().bpo-12915: A new function
resolve_namehas been added to thepkgutilmodule. This resolves a string of the form'a.b.c.d'or'a.b:c.d'to an object. In the example,a.bis a package/module andc.dis an object within that package/module reached via recursive attribute access.bpo-39353: The
binascii.crc_hqx()function is no longer deprecated.bpo-39493: Mark
typing.IO.closedas a propertybpo-39491: Add
typing.Annotatedandinclude_extrasparameter totyping.get_type_hints()as part of PEP 593. Patch by Till Varoquaux, documentation by Till Varoquaux and Konstantin Kashin.bpo-39485: Fix a bug in
unittest.mock.create_autospec()that would complain about the wrong number of arguments for custom descriptors defined in an extension module returning functions.bpo-38932: Mock fully resets child objects on reset_mock(). Patch by Vegard Stikbakke
bpo-39082: Allow AsyncMock to correctly patch static/class methods
bpo-39432: Implement PEP-489 algorithm for non-ascii “PyInit_…” symbol names in distutils to make it export the correct init symbol also on Windows.
bpo-18819: Omit
devmajoranddevminorfields for non-device files intarfilearchives, enabling bit-for-bit compatibility with GNUtar(1).bpo-39349: Added a new cancel_futures parameter to
concurrent.futures.Executor.shutdown()that cancels all pending futures which have not started running, instead of waiting for them to complete before shutting down the executor.bpo-39274:
bool(fraction.Fraction)now returns a boolean even if (numerator != 0) does not return a boolean (ex: numpy number).bpo-34793: Remove support for
with (await asyncio.lock):andwith (yield from asyncio.lock):. The same is correct forasyncio.Conditionandasyncio.Semaphore.bpo-25597: Ensure, if
wrapsis supplied tounittest.mock.MagicMock, it is used to calculate return values for the magic methods instead of using the default return values. Patch by Karthikeyan Singaravelan.bpo-36350:
inspect.Signature.parametersandinspect.BoundArguments.argumentsare now dicts instead of OrderedDicts. Patch contributed by Rémi Lapeyre.bpo-35727: Fix sys.exit() and sys.exit(None) exit code propagation when used in multiprocessing.Process.
bpo-32173: * Add
lazycachefunction to__all__. * Usedict.clearto clear the cache. * Refactoringgetlinefunction andcheckcachefunction.
Documentation¶
bpo-17422: The language reference now specifies restrictions on class namespaces. Adapted from a patch by Ethan Furman.
bpo-39572: Updated documentation of
totalflag ofTypedDict.bpo-39654: In pyclbr doc, update ‘class’ to ‘module’ where appropriate and add readmodule comment. Patch by Hakan Çelik.
bpo-39153: Clarify refcounting semantics for the following functions: - PyObject_SetItem - PyMapping_SetItemString - PyDict_SetItem - PyDict_SetItemString
bpo-39392: Explain that when filling with turtle, overlap regions may be left unfilled.
bpo-39369: Update mmap readline method description. The fact that the readline method does update the file position should not be ignored since this might give the impression for the programmer that it doesn’t update it.
bpo-9056: Include subsection in TOC for PDF version of docs.
Tests¶
bpo-38325: Skip tests on non-BMP characters of test_winconsoleio.
bpo-39502: Skip test_zipfile.test_add_file_after_2107() if
time.localtime()fails withOverflowError. It is the case on AIX 6.1 for example.
Build¶
bpo-39489: Remove
COUNT_ALLOCSspecial build.
Windows¶
bpo-39553: Delete unused code related to SxS manifests.
bpo-39439: Honor the Python path when a virtualenv is active on Windows.
bpo-39393: Improve the error message when attempting to load a DLL with unresolved dependencies.
bpo-38883:
home()andexpanduser()on Windows now preferUSERPROFILEand no longer useHOME, which is not normally set for regular user accounts. This makes them again behave likeos.path.expanduser(), which was changed to ignoreHOMEin 3.8, see bpo-36264.bpo-39185: The build.bat script has additional options for very-quiet output (-q) and very-verbose output (-vv)
IDLE¶
bpo-39663: Add tests for pyparse find_good_parse_start().
bpo-39600: In the font configuration window, remove duplicated font names.
bpo-30780: Add remaining configdialog tests for buttons and highlights and keys tabs.
bpo-39388: IDLE Settings Cancel button now cancels pending changes
bpo-38792: Close an IDLE shell calltip if a
KeyboardInterruptor shell restart occurs. Patch by Zackery Spytz.
C API¶
bpo-35081: Move the
bytes_methods.hheader file to the internal C API aspycore_bytes_methods.h: it only contains private symbols (prefixed by_Py), except of thePyDoc_STRVAR_shared()macro.bpo-35081: Move the
dtoa.hheader file to the internal C API aspycore_dtoa.h: it only contains private functions (prefixed by_Py). Themathandcmathmodules must now be compiled with thePy_BUILD_COREmacro defined.bpo-39573: Add
Py_SET_SIZE()function to set the size of an object.bpo-39500:
PyUnicode_IsIdentifier()does not callPy_FatalError()anymore if the string is not ready.bpo-39573: Add
Py_SET_TYPE()function to set the type of an object.bpo-39573: Add a
Py_SET_REFCNT()function to set the reference counter of an object.bpo-39542: Convert
PyType_HasFeature(),PyType_Check()andPyType_CheckExact()macros to static inline functions.bpo-39542: In the limited C API,
PyObject_INIT()andPyObject_INIT_VAR()are now defined as aliases toPyObject_Init()andPyObject_InitVar()to make their implementation opaque. It avoids to leak implementation details in the limited C API. Exclude the following functions from the limited C API:_Py_NewReference(),_Py_ForgetReference(),_PyTraceMalloc_NewReference()and_Py_GetRefTotal().bpo-39542: Exclude trashcan mechanism from the limited C API: it requires access to PyTypeObject and PyThreadState structure fields, whereas these structures are opaque in the limited C API.
bpo-39511: The
PyThreadState_Clear()function now calls thePyThreadState.on_deletecallback. Previously, that happened inPyThreadState_Delete().bpo-38076: Fix to clear the interpreter state only after clearing module globals to guarantee module state access from C Extensions during runtime destruction
bpo-39245: The Vectorcall API (PEP 590) was made public, adding the functions
PyObject_Vectorcall,PyObject_VectorcallMethod,PyVectorcall_Function,PyObject_CallOneArg,PyObject_CallMethodNoArgs,PyObject_CallMethodOneArg,PyObject_FastCallDict, and the flagPy_TPFLAGS_HAVE_VECTORCALL.
Python 3.9.0 alpha 3¶
Release date: 2020-01-24
Core and Builtins¶
bpo-39427: Document all possibilities for the
-Xoptions in the command line help section. Patch by Pablo Galindo.bpo-39421: Fix possible crashes when operating with the functions in the
heapqmodule and custom comparison operators.bpo-39386: Prevent double awaiting of async iterator.
bpo-17005: Add
functools.TopologicalSorterto thefunctoolsmodule to offers functionality to perform topological sorting of graphs. Patch by Pablo Galindo, Tim Peters and Larry Hastings.bpo-39320: Replace four complex bytecodes for building sequences with three simpler ones.
The following four bytecodes have been removed:
BUILD_LIST_UNPACK
BUILD_TUPLE_UNPACK
BUILD_SET_UNPACK
BUILD_TUPLE_UNPACK_WITH_CALL
The following three bytecodes have been added:
LIST_TO_TUPLE
LIST_EXTEND
SET_UPDATE
bpo-39336: Import loaders which publish immutable module objects can now publish immutable packages in addition to individual modules.
bpo-39322: Added a new function
gc.is_finalized()to check if an object has been finalized by the garbage collector. Patch by Pablo Galindo.bpo-39048: Improve the displayed error message when incorrect types are passed to
async withstatements by looking up the__aenter__()special method before the__aexit__()special method when entering an asynchronous context manager. Patch by Géry Ogam.bpo-39235: Fix AST end location for lone generator expression in function call, e.g. f(i for i in a).
