uuid
no longer uses ctypes
to load libuuid
or rpcrt4.dll
at runtime.
Correctly generate annotations where parentheses are omitted but required (e.g: Type[(str, int, *other))]
.
Fixed str.isidentifier
for non-canonicalized strings containing non-BMP characters on Windows.
Improved syntax errors for invalid characters in source code.
Fixed a bug when using codeop.compile_command
that was causing exceptions to be swallowed with the new parser. Patch by Pablo Galindo
Apply 573
to abc
.
Initialize n->n_col_offset
. (Patch by Joannah Nanjekye)
Fix command line argument parsing: no longer write errors multiple times into stderr.
Port errno
to multiphase initialization (489
).
Add pass-throughs for hash
and reversed
to weakref.proxy
objects. Patch by Pablo Galindo.
Port syslog
to multiphase initialization (489
).
Reporting a specialised error message for invalid string prefixes, which was introduced in 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.
Fix imp module deprecation warning when PyImport_ReloadModule is called. Patch by Robert Rouhani.
Fixed support of nested type variables in GenericAlias (e.g. list[list[T]]
).
Port _stat module to multiphase initialization (489
).
Enable implicit exception chaining when calling generator.throw
.
Add tools for generating mappings headers for CJKCodecs.
Setting frame.f_lineno is now robust w.r.t. changes in the source-to-bytecode compiler
Added the ability to list interpreters associated with channel ends in the internal subinterpreters module.
Improve performance of :cPyLong_FromDouble
for values that fit into :clong
.
Fixed ast.get_source_segment
for ast nodes that have incomplete location information. Patch by Irit Katriel.
Convert bisect
to use Argument Clinic.
Added the ~zoneinfo.available_timezones
function to the zoneinfo
module. Patch by Paul Ganssle.
The hmac.HMAC
exposes internal implementation details. The attributes digest_cons
, inner
, and outer
are deprecated and will be removed in the future.
The internal module _hashlib
wraps 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.
Builtin hash modules can now be disabled or selectively enabled with configure --with-builtin-hashlib-hashes=sha3,blake1
or --without-builtin-hashlib-hashes
.
The hashlib
module can now use SHA3 hashes and SHAKE XOF from OpenSSL when available.
The hashlib
now compiles with OpenSSL 3.0.0-alpha2.
Revert changes to inspect.getdoc
.
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.
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.
If text content lines are longer than policy.max_line_length, always use a content-encoding to make sure they are wrapped.
Added functools.cache() as a simpler, more discoverable way to access the unbounded cache variant of lru_cache(maxsize=None).
615
, the zoneinfo
module. Adds support for the IANA time zone database.
Removed attributes __args__
and __parameters__
from special generic aliases like typing.List
(not subscripted).
Convert posixmodule.c ("posix" or "nt" module) to the multiphase initialization (PEP 489).
Add a msg
argument to Future.cancel
and Task.cancel
.
Added an optional counts parameter to random.sample().
The ssl
and hashlib
modules 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.
When a asyncio.Task
is cancelled, the exception traceback now chains all the way back to where the task was first interrupted.
functools.lru_cache
objects can now be the targets of weakrefs.
Fix possible memory leak in the C implementation of asyncio.Task
.
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.
compileall
is now able to use hardlinks to prevent duplicates in a case when .pyc
files for different optimization levels have the same content.
The ssl module now support OpenSSL builds without TLS 1.0 and 1.1 methods.
Improve error reporting in ast.literal_eval
in the presence of malformed ast.Dict
nodes instead of silently ignoring any non-conforming elements. Patch by Curtis Bucher.
Deprecated the optional random argument to random.shuffle().
platform.win32_ver
now produces correct ptype strings instead of empty strings.
The first argument of pickle.loads
is now positional-only.
Update !nntplib
to merge !nntplib.NNTP
and !nntplib._NNTPBase
. Patch by Donghee Na.
Update dbm.gnu
to use gdbm_count if possible when calling len
. Patch by Donghee Na.
Add isolated=True
keyword-only parameter to _xxsubinterpreters.create()
. An isolated subinterpreter cannot spawn threads, spawn a child process or call os.fork()
.
Remove _random.Random.randbytes()
: the C implementation of randbytes()
. Implement the method in Python to ease subclassing: randbytes()
now directly reuses getrandbits()
.
Added default arguments to difflib.SequenceMatcher.find_longest_match()
.
Fix a race condition in concurrent.futures._ThreadWakeup: access to _ThreadWakeup is now protected with the shutdown lock.
Process.shutdown(wait=True)
of concurrent.futures
now closes explicitly the result queue.
Add a new ~multiprocessing.SimpleQueue.close
method to the ~multiprocessing.SimpleQueue
class to explicitly close the queue.
Revert bpo-25597. unittest.mock.MagicMock
with wraps' set uses default return values for magic methods.
Added files()
function to importlib.resources with support for subdirectories in package data, matching backport in importlib_resources 1.5.
imaplib.IMAP4.unselect
is added. Patch by Donghee Na.
repr()
now returns typing.Optional[T]
when called for typing.Union
of two types, one of which is NoneType
.
Add support for CAN_J1939 sockets (available on Linux 5.4+)
types.MappingProxyType
is now reversible.
The repr for types.SimpleNamespace
is now insertion ordered rather than alphabetical.
On AIX, ~time.thread_time
is now implemented with thread_cputime()
which has nanosecond resolution, rather than clock_gettime(CLOCK_THREAD_CPUTIME_ID)
which has a resolution of 10 milliseconds. Patch by Batuhan Taskaya.
Raise TypeError when _generate_next_value is defined after members. Patch by Ethan Onstott.
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.
The isocalendar()
methods of datetime.date
and datetime.datetime
now return a named tuple
instead of a tuple
.
Add version of removal for explicit passing of coros to asyncio.wait()
's documentation
Provide docstrings for webbrowser open functions.
Mention that asyncio.wait
requires a non-empty set of awaitables.
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.
Fix an incorrect signature for pickle.loads
in the docs
distutils.tests now saves/restores warnings filters to leave them unchanged. Importing tests imports docutils which imports pkg_resources which adds a warnings filter.
test_gdb and test.pythoninfo now check gdb command exit code.
Move _dirnameW out of HAVE_SYMLINK to fix a potential compiling issue.
Add --with-experimental-isolated-subinterpreters
build option to configure
: better isolate subinterpreters, experimental build mode.
Include winsock2.h in pytime.c for timeval.
Increase reserved stack space to prevent overflow crash on Windows.
Add IPv6 support to asyncio
datagram endpoints in ProactorEventLoop. Change the raised exception for unknown address families to ValueError as it's not coming from Windows API.
When building Python on macOS from source, _tkinter
now 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-includes
and --with-tcltk-libs
.
Expose RFC 3542 IPv6 socket options.
Update multissltest helper to test with latest OpenSSL 1.0.2, 1.1.0, 1.1.1, and 3.0.0-alpha.
Fix a syntax typo in turtledemo
that now raises a SyntaxError
.
Fix multissltest tool. OpenSSL has changed download URL for old releases. The multissltest tool now tries to download from current and old download URLs.
Remove the _PyUnicode_ClearStaticStrings()
function from the C API.
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.
Declare _PyErr_GetTopmostException()
with PyAPI_FUNC()
to properly export the function in the C API. The function remains private (_Py
) prefix.
Nullify inittab_copy during finalization, preventing future interpreter initializations in an embedded situation from crashing. Patch by Gregory Szorc.
The :cPyThreadState_GetFrame
function now returns a strong reference to the frame.
Remove the following functions from the C API. Call :cPyGC_Collect
explicitly to free all free lists.
PyAsyncGen_ClearFreeLists()
PyContext_ClearFreeList()
PyDict_ClearFreeList()
PyFloat_ClearFreeList()
PyFrame_ClearFreeList()
PyList_ClearFreeList()
PySet_ClearFreeList()
PyTuple_ClearFreeList()
New :cPyFrame_GetBack
function: get the frame next outer frame.
New :cPyFrame_GetCode
function: return a borrowed reference to the frame code.
Ensure that instances of types created with :cPyType_FromSpecWithBases
will visit its class object when traversing references in the garbage collector (implemented as an extension of the provided :c~PyTypeObject.tp_traverse
). Patch by Pablo Galindo.
Module C state is now accessible from C-defined heap type methods (573
). Patch by Marcel Plch and Petr Viktorin.