Skip to content

Latest commit

 

History

History
6746 lines (4819 loc) · 152 KB

3.13.0a1.rst

File metadata and controls

6746 lines (4819 loc) · 152 KB

Fixed an issue where instances of :class:`ssl.SSLSocket` were vulnerable to a bypass of the TLS handshake and included protections (like certificate verification) and treating sent unencrypted data as if it were post-handshake TLS encrypted data. Security issue reported as :cve:`2023-40217` by Aapo Oksman. Patch by Gregory P. Smith.

PEP 669 specifies that sys.monitoring.register_callback will generate an audit event. Pre-releases of Python 3.12 did not generate the audit event. This is now fixed.

Reverted the :mod:`email.utils` security improvement change released in 3.12beta4 that unintentionally caused :mod:`email.utils.getaddresses` to fail to parse email addresses with a comma in the quoted name field. See :gh:`106669`.

Refresh our new HACL* built-in :mod:`hashlib` code from upstream. Built-in SHA2 should be faster and an issue with SHA3 on 32-bit platforms is fixed.

Start initializing ob_digit during creation of :c:type:`PyLongObject` objects. Patch by Illia Volochii.

Fix crash when :class:`typing.TypeVar` is constructed with a keyword argument. Patch by Jelle Zijlstra.

Reset ceval.eval_breaker in :func:`interpreter_clear`

Use the :mod:`traceback` implementation for the default :c:func:`PyErr_Display` functionality. Patch by Pablo Galindo

Fix incorrect error message for invalid argument unpacking. Patch by Pablo Galindo

Split the tokenizer into two separate directories: - One part includes the actual lexeme producing logic and lives in Parser/lexer. - The second part wraps the lexer according to the different tokenization modes we have (string, utf-8, file, interactive, readline) and lives in Parser/tokenizer.

Remove undocumented test_c_api method from :class:`set`, which was only defined for testing purposes under Py_DEBUG. Now we have proper CAPI tests.

Fix a reference leak when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` enabled.

Add PY_THROW to :func:`sys.setprofile` events

Optimise :func:`math.ceil` when the input is exactly a float, resulting in about a 10% improvement.

Guard assert(tstate->thread_id > 0) with #ifndef HAVE_PTHREAD_STUBS. This allows for for pydebug builds to work under WASI which (currently) lacks thread support.

Remove unnecessary empty constant nodes in the ast of f-string specs.

Correctly identify the format spec in f-strings (with single or triple quotes) that have multiple lines in the expression part and include a formatting spec. Patch by Pablo Galindo

Fix missing error checks for calls to PyList_Append in _PyEval_MatchClass.

regrtest: If the SOURCE_DATE_EPOCH environment variable is defined, regrtest now disables tests randomization. Patch by Victor Stinner.

Fix the compiler's redundant NOP detection algorithm to skip over NOPs with no line number when looking for the next instruction's lineno.

sys.path[0] is now set correctly for subinterpreters.

Set line number on the POP_TOP that follows a RETURN_GENERATOR.

Subinterpreters now correctly handle the case where they have threads running in the background. Before, such threads would interfere with cleaning up and destroying them, as well as prevent running another script.

The internal eval_breaker and supporting flags, plus the monitoring version have been merged into a single atomic integer to speed up checks.

Fix bug where compiler does not adjust labels when removing an empty basic block which is a jump target.

The main thread no longer exits prematurely when a subinterpreter is cleaned up during runtime finalization. The bug was a problem particularly because, when triggered, the Python process would always return with a 0 exitcode, even if it failed.

Fix missing jump target labels when compiler reorders cold/warm blocks.

Add :option:`-X cpu_count <-X>` command line option to override return results of :func:`os.cpu_count` and :func:`os.process_cpu_count`. This option is useful for users who need to limit CPU resources of a container system without having to modify the container (application code). Patch by Donghee Na.

Fix bug where the compiler does not assign a new jump target label to a duplicated small exit block.

Fix some tokens in the grammar that were incorrectly marked as soft keywords. Also fix some repeated rule names and ensure that repeated rules are not allowed. Patch by Pablo Galindo

On a Python built in debug mode, :c:func:`Py_DECREF()` now calls _Py_NegativeRefcount() if the object is a dangling pointer to deallocated memory: memory filled with 0xDD "dead byte" by the debug hook on memory allocators. The fix is to check the reference count before checking for _Py_IsImmortal(). Patch by Victor Stinner.

Deopt opcodes hidden by the executor when base opcode is needed

Deopted instructions correctly for tool initialization and modified the incorrect assertion in instrumentation, when a previous tool already sets INSTRUCTION events

Fix bug where the line trace of an except block ending with a conditional includes an excess event with the line of the conditional expression.

Fix compiling type param scopes that use a name which is also free in an inner scope.

Fix crash when compiling an invalid AST involving a named (walrus) expression.

Fix crash when compiling an invalid AST involving a :class:`ast.TypeAlias`.

Fix source location for the LOAD_* instruction preceding a LOAD_SUPER_ATTR to load the super global (or shadowing variable) so that it encompasses only the name super and not the following parentheses.

Opcode IDs for specialized opcodes are allocated in their own range to improve stability of the IDs for the 'real' opcodes.

Fix possible memory leak in :opcode:`BUILD_MAP`.

Fix a SystemError in __repr__ of symtable entry object.

Fix bug where the C traceback display drops notes from :exc:`SyntaxError`.

Disallow nested scopes (lambdas, generator expressions, and comprehensions) within PEP 695 annotation scopes that are nested within classes.

Add tests for de-instrumenting instructions while keeping the instrumentation for lines

Relax the detection of the error message for invalid lambdas inside f-strings to not search for arbitrary replacement fields to avoid false positives. Patch by Pablo Galindo

Add a new :opcode:`CALL_KW` opcode, used for calls containing keyword arguments. Also, fix a possible crash when jumping over method calls in a debugger.

Use the base opcode when comparing code objects to avoid interference from instrumentation

Fix interpreter crash when a NameError is raised inside the type parameters of a generic class.

Improve syntax error for non-ASCII character that follows a numerical literal. It now points on the invalid non-ASCII character, not on the valid numerical literal.

Fix crash that occurs after de-instrumenting a code object in a monitoring callback.

Make iteration variables of module- and class-scoped comprehensions visible to pdb and other tools that use frame.f_locals again.

Fix caret placement for error locations for subscript and binary operations that involve non-semantic parentheses and spaces. Patch by Pablo Galindo

Fix a crash when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` enabled and an error occurs during optimization.

Define tp_dealloc for CounterOptimizer_Type. This fixes a segfault on deallocation.

Fix :meth:`multiprocessing.synchronize.SemLock.__setstate__` to properly initialize :attr:`multiprocessing.synchronize.SemLock._is_fork_ctx`. This fixes a regression when passing a SemLock across nested processes.

Rename :attr:`multiprocessing.synchronize.SemLock.is_fork_ctx` to :attr:`multiprocessing.synchronize.SemLock._is_fork_ctx` to avoid exposing it as public API.

Restore locals shadowed by an inlined comprehension if the comprehension raises an exception.

Change the initialization of inline cache entries so that the cache entry for JUMP_BACKWARD is initialized to zero, instead of the adaptive_counter_warmup() value used for all other instructions. This counter, unique among instructions, counts up from zero.

Turn off deep-freezing of code objects. Modules are still frozen, so that a file system search is not needed for common modules.

Add RESUME_CHECK instruction, to avoid having to handle instrumentation, signals, and contexts switches in the tier 2 execution engine.

Move an assert that would cause a spurious crash in a devious case that should only trigger deoptimization.

Use a WeakValueDictionary to track the lists containing the modules each thread is currently importing. This helps avoid a reference leak from keeping the list around longer than necessary. Weakrefs are used as GC can't interrupt the cleanup.

The regen-opcode build stage was removed and its work is now done in regen-cases.

Fix missing line number on :opcode:`JUMP_BACKWARD` at the end of a for loop.

The :func:`compile` built-in can now accept a new flag, ast.PyCF_OPTIMIZED_AST, which is similar to ast.PyCF_ONLY_AST except that the returned AST is optimized according to the value of the optimize argument.

:func:`ast.parse` now accepts an optional argument optimize which is passed on to the :func:`compile` built-in. This makes it possible to obtain an optimized AST.

Opcode IDs are generated from bytecodes.c instead of being hard coded in opcode.py.

Improve error message for function calls with bad keyword arguments. Patch by Pablo Galindo

Raise an exception when setting a non-local event (RAISE, EXCEPTION_HANDLED, etc.) in sys.monitoring.set_local_events.

Fixes crash when tracing in recursive calls to Python classes.

Remove the _PyCFrame struct, moving the pointer to the current interpreter frame back to the threadstate, as it was for 3.10 and earlier. The _PyCFrame existed as a performance optimization for tracing. Since PEP 669 has been implemented, this optimization no longer applies.

Fix abort / segfault when using all eight type watcher slots, on platforms where char is signed by default.

Fix possible assertion failures and missing instrumentation events when :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` is enabled.

Revert converting vars, dir, next, getattr, and iter to argument clinic.

Autogenerate signature for :c:macro:`METH_NOARGS` and :c:macro:`METH_O` extension functions.

Make the dump_stack() routine used by the lltrace feature (low-level interpreter debugging) robust against recursion by ensuring that it never calls a __repr__ method implemented in Python. Also make the similar output for Tier-2 uops appear on stdout (instead of stderr), to match the lltrace code in ceval.c.

Add docstrings for :func:`ctypes.pointer` and :func:`ctypes.POINTER`.

Modify the bytecode so that the actual callable for a :opcode:`CALL` is at a consistent position on the stack (regardless of whether or not bound-method-calling optimizations are active).

Fixed performance regression in sys.settrace.

In pre-release versions of 3.12, up to rc1, the sys.monitoring callback function for the PY_THROW event was missing the third, exception argument. That is now fixed.

Skip reference count modifications for many known immortal objects.

Specialize subscripting :class:`str` objects by :class:`int` indexes.

Trace refs builds (--with-trace-refs) were crashing when used with isolated subinterpreters. The problematic global state has been isolated to each interpreter. Other fixing the crashes, this change does not affect users.

Generate the cases needed for the barebones tier 2 abstract interpreter for optimization passes in CPython.

Make _PyUOpExecutorObject variable length.

Clear generators' exception state after return to break reference cycles.

Improve error messages when converting an incompatible type to :class:`ctypes.c_char_p`, :class:`ctypes.c_wchar_p` and :class:`ctypes.c_void_p`.

Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like list.__repr__ and json.dumps to handle all the inputs that they could prior to 3.12

Fix an issue which caused incorrect inline caches to be read when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` enabled.

Fix potential unaligned memory access on C APIs involving returned sequences of char * pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a -fsaniziter=alignment build on ARM macOS. Patch by Christopher Chavez.

Isolate :mod:`!_decimal` (apply PEP 687). Patch by Charlie Zhao.

Add the exception as the third argument to PY_UNIND callbacks in sys.monitoring. This makes the PY_UNWIND callback consistent with the other exception handling callbacks.

Raise a ValueError when a monitoring callback function returns DISABLE for events that cannot be disabled locally.

Add a RERAISE event to sys.monitoring, which occurs when an exception is reraise, either explicitly by a plain raise statement, or implicitly in an except or finally block.

Ensure that multiprocessing synchronization objects created in a fork context are not sent to a different process created in a spawn context. This changes a segfault into an actionable RuntimeError in the parent process.

Statically allocated string objects are now interned globally instead of per-interpreter. This fixes a situation where such a string would only be interned in a single interpreter. Normal string objects are unaffected.

Unsupported modules now always fail to be imported.

Add :meth:`dbm.ndbm.ndbm.clear` to :mod:`dbm.ndbm`. Patch By Donghee Na.

Add :meth:`dbm.gnu.gdbm.clear` to :mod:`dbm.gnu`. Patch By Donghee Na.

The ASYNC and AWAIT tokens are removed from the Grammar, which removes the possibility of making async and await soft keywords when using feature_version<7 in :func:`ast.parse`.

Fix classmethod-style :func:`super` method calls (i.e., where the second argument to :func:`super`, or the implied second argument drawn from self/cls in the case of zero-arg super, is a type) when the target of the call is not a classmethod.

Python no longer crashes due an infrequent race when initializing per-interpreter interned strings. The crash would manifest when the interpreter was finalized.

Python no longer crashes due to an infrequent race in setting Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors (both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization.

Fix various hangs, reference leaks, test failures, and tracing/introspection bugs when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` enabled.

Fix a segmentation fault caused by a use-after-free bug in frame_dealloc when the trashcan delays the deallocation of a PyFrameObject.

Reduce the number of materialized instances dictionaries by dematerializing them when possible.

No longer suppress arbitrary errors in the __annotations__ getter and setter in the type and module types.

Propagate frozen_modules to multiprocessing spawned process interpreters.

Split :opcode:`LOAD_ATTR_INSTANCE_VALUE` into micro-ops.

Split :opcode:`LOAD_GLOBAL` specializations into micro-ops.

A new debug structure of offsets has been added to the _PyRuntimeState that will help out-of-process debuggers and profilers to obtain the offsets to relevant interpreter structures in a way that is agnostic of how Python was compiled and that doesn't require copying the headers. Patch by Pablo Galindo

Allow the count argument of :meth:`str.replace` to be a keyword. Patch by Hugo van Kemenade.

Improve error message of :meth:`list.remove`. Patch by Donghee Na.

Compiler now strips indents from docstrings. It reduces pyc file size 5% when the module is heavily documented. This change affects to __doc__ so tools like doctest will be affected.

When the format specification of an f-string expression is empty, the parser now generates an empty :class:`ast.JoinedStr` node for it instead of an one-element :class:`ast.JoinedStr` with an empty string :class:`ast.Constant`.

Specialize :opcode:`LOAD_ATTR` for non-descriptors on the class. Adds :opcode:`LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES` and :opcode:`LOAD_ATTR_NONDESCRIPTOR_NO_DICT`.

Fix possible reference leaks when failing to optimize comparisons with :const:`None` in the bytecode compiler.

Make end_lineno and end_col_offset required on type_param ast nodes.

Changed the way that Emscripten call trampolines work for compatibility with Wasm/JS Promise integration.

:func:`sys.getfilesystemencoding` and :mod:`sys.getfilesystemencodeerrors` now return interned Unicode object.

Removed Emscripten import trampoline as it was no longer necessary for Pyodide.

Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass -Xuops or set PYTHONUOPS=1. To get debug output, set PYTHONUOPSDEBUG=N where N is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose).

:opcode:`LOAD_CLOSURE` is now a pseudo-op.

Allow any callable other than type objects as the condition predicate in :meth:`BaseExceptionGroup.split` and :meth:`BaseExceptionGroup.subgroup`.

Fix crash in :func:`!_imp.get_frozen_object` due to improper exception handling.

Add a new :opcode:`TO_BOOL` instruction, which performs boolean conversions for :opcode:`POP_JUMP_IF_TRUE`, :opcode:`POP_JUMP_IF_FALSE`, and :opcode:`UNARY_NOT` (which all expect exact :class:`bool` values now). Also, modify the oparg of :opcode:`COMPARE_OP` to include an optional "boolean conversion" flag.

Ensure custom :exc:`SyntaxError` error messages are raised for invalid imports with multiple targets. Patch by Pablo Galindo

Improve assert error messages by providing exact error range.

Fixed bug where :gh:`99111` breaks future import barry_as_FLUFL in the Python REPL.

Fix possible crashes when specializing function calls with too many __defaults__.

Fix an f-string bug, where using a debug expression (the = sign) that appears in the last line of a file results to the debug buffer that holds the expression text being one character too small.

Correctly issue :exc:`SyntaxWarning` in f-strings if invalid sequences are used. Patch by Pablo Galindo

Include the comprehension iteration variable in locals() inside a module- or class-scope comprehension.

Raise :exc:`ValueError` if the delay argument to :func:`asyncio.sleep` is a NaN (matching :func:`time.sleep`).

The runtime can't guarantee that immortal objects will not be mutated by Extensions. Thus, this modifies _PyStaticObject_CheckRefcnt to warn instead of asserting.

Don't include artificil newlines in the line attribute of tokens in the APIs of the :mod:`tokenize` module. Patch by Pablo Galindo

Tokenize separately NUMBER and NAME tokens that are not ambiguous. Patch by Pablo Galindo.

Fix an issue that could result in crashes when compiling malformed :mod:`ast` nodes.

Allow objects other than code objects as the "executable" in internal frames. In the long term, this can help tools like Cython and PySpy interact more efficiently. In the shorter term, it allows us to perform some optimizations more simply.

Fix bugs in the :mod:`builtins` module where exceptions could end up being overwritten.

Fix bug in the compiler where an exception could end up being overwritten.

Improve error handling in :c:func:`PyUnicode_BuildEncodingMap` where an exception could end up being overwritten.

Change the repr of ParamSpec list of args in types.GenericAlias.

Break the MAKE_FUNCTION instruction into two parts, MAKE_FUNCTION which makes the function and SET_FUNCTION_ATTRIBUTE which sets the attributes on the function. This makes the stack effect of MAKE_FUNCTION regular to ease optimization and code generation.

Fix spurious newline character if file ends on a comment without a newline. Patch by Pablo Galindo

Correctly raise :exc:`tokenize.TokenError` exceptions instead of :exc:`SyntaxError` for tokenize errors such as incomplete input. Patch by Pablo Galindo

Don't include newline character for trailing NEWLINE tokens emitted in the :mod:`tokenize` module. Patch by Pablo Galindo

Eliminate redundant :opcode:`STORE_FAST` instructions in the compiler. Patch by Donghee Na and Carl Meyer.

Fix the main function of the :mod:`tokenize` module when reading from sys.stdin. Patch by Pablo Galindo

Simplify and speed up interpreter for f-strings. Removes FORMAT_VALUE opcode. Add CONVERT_VALUE, FORMAT_SIMPLE and FORMAT_WITH_SPEC opcode. Compiler emits more efficient sequence for each format expression.

Remove remaining two-codeunit superinstructions. All remaining superinstructions only take a single codeunit, simplifying instrumentation and quickening.

Prevent out-of-bounds memory access during mmap.find() calls.

Restore the ability for a subclass of :class:`property` to define __slots__ or otherwise be dict-less by ignoring failures to set a docstring on such a class. This behavior had regressed in 3.12beta1. An :exc:`AttributeError` where there had not previously been one was disruptive to existing code.

The "pending call" machinery now works for all interpreters, not just the main interpreter, and runs in all threads, not just the main thread. Some calls are still only done in the main thread, ergo in the main interpreter. This change does not affect signal handling nor the existing public C-API (Py_AddPendingCall()), which both still only target the main thread. The new functionality is meant strictly for internal use for now, since consequences of its use are not well understood yet outside some very restricted cases. This change brings the capability in line with the intention when the state was made per-interpreter several years ago.

Do not escape with backslashes f-string format specifiers. Patch by Pablo Galindo

Replace some dynamic superinstructions with single instruction equivalents.

Fixed bug in generator.close()/throw() where an inner iterator would be ignored when the outer iterator was instrumented.

Ensure annotations are set up correctly if the only annotation in a block is within a :keyword:`match` block. Patch by Jelle Zijlstra.

Make _PyASTOptimizeState internal to ast_opt.c. Make _PyAST_Optimize take two integers instead of a pointer to this struct. This avoids the need to include pycore_compile.h in ast_opt.c.

Attributes of :mod:`ast` nodes that are lists now default to the empty list if omitted. This means that some code that previously raised :exc:`TypeError` when the AST node was used will now proceed with the empty list instead. Patch by Jelle Zijlstra.

Remove the old trashcan macros Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END. They should be replaced by the new macros Py_TRASHCAN_BEGIN and Py_TRASHCAN_END.

Fix :func:`super` calls on types with custom :c:member:`~PyTypeObject.tp_getattro` implementation (e.g. meta-types.)

Show CRLF lines in the tokenize string attribute in both NL and NEWLINE tokens. Patch by Marta Gómez.

Fix handling of multiline parenthesized lambdas in :func:`inspect.getsource`. Patch by Pablo Galindo

Do not include an additional final NL token when parsing files having CRLF lines. Patch by Marta Gómez.

Ensure that trailing DEDENT :class:`tokenize.TokenInfo` objects emitted by the :mod:`tokenize` module are reported as in Python 3.11. Patch by Pablo Galindo

Ensure that the line attribute in :class:`tokenize.TokenInfo` objects in the :mod:`tokenize` module are always correct. Patch by Pablo Galindo

Fix signature for the new :meth:`~object.__release_buffer__` slot. Patch by Jelle Zijlstra.

Starting new threads and process creation through :func:`os.fork` during interpreter shutdown (such as from :mod:`atexit` handlers) is no longer supported. It can lead to race condition between the main Python runtime thread freeing thread states while internal :mod:`threading` routines are trying to allocate and use the state of just created threads. Or forked children trying to use the mid-shutdown runtime and thread state in the child process.

Fix crash when accessing the __module__ attribute of type aliases defined outside a module. Patch by Jelle Zijlstra.

Tokens emitted by the :mod:`tokenize` module do not include an implicit \n character in the line attribute anymore. Patch by Pablo Galindo

If a generator returns a value upon being closed, the value is now returned by :meth:`generator.close`.

Raise :exc:`RuntimeWarning` for unawaited async generator methods like :meth:`~agen.asend`, :meth:`~agen.athrow` and :meth:`~agen.aclose`. Patch by Kumar Aditya.

Add a better, more introspect-able error message when setting attributes on classes without a __dict__ and no slot member for the attribute.

Update the Python pickle module implementation to match the C implementation of the pickle module. For objects setting reduction methods like :meth:`~object.__reduce_ex__` or :meth:`~object.__reduce__` to None, pickling will result in a :exc:`TypeError`.

Improve error handling when read :mod:`marshal` data.

Specializes calls to most Python classes. Specifically, any class that inherits from object, or another Python class, and does not override __new__.

The specialized instruction does the following:

  1. Creates the object (by calling object.__new__)
  2. Pushes a shim frame to the frame stack (to cleanup after __init__)
  3. Pushes the frame for __init__ to the frame stack

Speeds up the instantiation of most Python classes.

:mod:`sysconfig`'s CLI now ignores :exc:`BrokenPipeError`, making it exit normally if its output is being piped and the pipe closes.

The :mod:`sysconfig` module is now a package, instead of a single-file module.

Micro-optimization: Avoid calling min(), max() in :meth:`BaseEventLoop._run_once`.

Added :class:`asyncio.EventLoop` for use with the :func:`asyncio.run` loop_factory kwarg to avoid calling the asyncio policy system.

:func:`runtime-checkable protocols <typing.runtime_checkable>` used to consider __match_args__ a protocol member in __instancecheck__ if it was present on the protocol. Now, this attribute is ignored if it is present.

Fix a couple of issues in :meth:`pathlib.PurePath.with_name`: a single dot was incorrectly considered a valid name, and in :class:`PureWindowsPath`, a name with an NTFS alternate data stream, like a:b, was incorrectly considered invalid.

Fix a bug in :meth:`!_sre.compile` where :exc:`TypeError` would be overwritten by :exc:`OverflowError` when the code argument was a list of non-ints.

Prevent :mod:`pdb` from crashing when trying to display undisplayable objects

Deprecation warning about non-integer number in :mod:`gettext` now always refers to the line in the user code where gettext function or method is used. Previously it could refer to a line in gettext code.

Deprecate non-standard format specifier "N" for :class:`decimal.Decimal`. It was not documented and only supported in the C implementation.

:func:`~contextlib.contextmanager` and :func:`~contextlib.asynccontextmanager` context managers now close an invalid underlying generator object that yields more then one value.

In :mod:`pdb`, set convenience variable $_exception for post mortem debugging.

Fix :func:`termios.tcsetattr` bug that was overwriting existing errors during parsing integers from term list.

Slightly improve the import time of several standard-library modules by deferring imports of :mod:`warnings` within those modules. Patch by Alex Waygood.

:func:`dataclasses.replace` now raises TypeError instead of ValueError if specify keyword argument for a field declared with init=False or miss keyword argument for required InitVar field.

Add --inline-caches flag to dis command line.

Fix a Python 3.12 regression in the import time of :mod:`random`. Patch by Alex Waygood.

Add support of struct sequence objects in :func:`copy.replace`. Patched by Xuehai Pan.

:mod:`multiprocessing`, :mod:`concurrent.futures`, :mod:`compileall`: Replace :func:`os.cpu_count` with :func:`os.process_cpu_count` to select the default number of worker threads and processes. Get the CPU affinity if supported. Patch by Victor Stinner.

Fix base case handling in statistics.quantiles. Now allows a single data point.

On Windows, multiprocessing Popen.terminate() now catches :exc:`PermissionError` and get the process exit code. If the process is still running, raise again the :exc:`PermissionError`. Otherwise, the process terminated as expected: store its exit code. Patch by Victor Stinner.

Fixed an issue that caused :meth:`KqueueSelector.select` to not return all the ready events in some cases when a file descriptor is registered for both read and write.

Update the :mod:`symtable` module to support the new scopes introduced by PEP 695.

Add new variables to :py:meth:`sysconfig.get_config_vars` on Windows: LIBRARY, LDLIBRARY, LIBDIR, SOABI, and Py_NOGIL.

:mod:`re` functions such as :func:`re.findall`, :func:`re.split`, :func:`re.search` and :func:`re.sub` which perform short repeated matches can now be interrupted by user.

Reduce the import time of :mod:`email.utils` by around 43%. This results in the import time of :mod:`email.message` falling by around 18%, which in turn reduces the import time of :mod:`importlib.metadata` by around 6%. Patch by Alex Waygood.

Fix :func:`reprlib.recursive_repr` not copying __type_params__ from decorated function.

:mod:`concurrent.futures`: The executor manager thread now catches exceptions when adding an item to the call queue. During Python finalization, creating a new thread can now raise :exc:`RuntimeError`. Catch the exception and call terminate_broken() in this case. Patch by Victor Stinner.

Ensure the signature of :func:`os.path.isdir` is identical on all platforms. Patch by Amin Alaee.

Improve import time of :mod:`functools` by around 13%. Patch by Alex Waygood.

:func:`shutil.which` will prefer files with an extension in PATHEXT if the given mode includes os.X_OK on win32. If no PATHEXT match is found, a file without an extension in PATHEXT can be returned. This change will have :func:`shutil.which` act more similarly to previous behavior in Python 3.11.

Reduce the import time of :mod:`enum` by over 50%. Patch by Alex Waygood.

Avoid deadlocking on a reentrant call to the multiprocessing resource tracker. Such a reentrant call, though unlikely, can happen if a GC pass invokes the finalizer for a multiprocessing object such as SemLock.

Reduce the import time of :mod:`typing` by around a third. Patch by Alex Waygood.

Add :func:`os.process_cpu_count` function to get the number of logical CPUs usable by the calling thread of the current process. Patch by Victor Stinner.

Add set_error_mode related constants in msvcrt module in Python debug build.

Fix :func:`os.stat` and :meth:`os.DirEntry.stat`: check for exceptions. Previously, on Python built in debug mode, these functions could trigger a fatal Python error (and abort the process) when a function succeeded with an exception set. Patch by Victor Stinner.

Expose the type of PyCapsule objects as types.CapsuleType.

You can now get the raw TLS certificate chains from TLS connections via :meth:`ssl.SSLSocket.get_verified_chain` and :meth:`ssl.SSLSocket.get_unverified_chain` methods.

Contributed by Mateusz Nowak.

Update :mod:`unicodedata` database to Unicode 15.1.0.

Remove unnecessary :func:`hasattr` check during :data:`typing.TypedDict` creation.

Remove unnecessary extra __slots__ in :class:`~datetime.datetime`'s pure python implementation to reduce memory size, as they are defined in the superclass. Patch by James Hilton-Balfe

:mod:`logging`: Use a context manager for lock acquisition.

:class:`http.server.CGIHTTPRequestHandler` has been deprecated for removal in 3.15. Its design is old and the web world has long since moved beyond CGI.

Fix error when it was possible to inherit a frozen dataclass from multiple parents some of which were possibly not frozen.

The :mod:`pdb` alias command now prevents registering aliases without arguments.

Deprecate the dis.HAVE_ARGUMENT field in favour of dis.hasarg.

Fix a race condition in concurrent.futures. When a process in the process pool was terminated abruptly (while the future was running or pending), close the connection write end. If the call queue is blocked on sending bytes to a worker process, closing the connection write end interrupts the send, so the queue can be closed. Patch by Victor Stinner.

The :class:`codecs.CodecInfo` object has been made copyable and pickleable. Patched by Robert Lehmann and Furkan Onder.

:meth:`pathlib.Path.resolve` now treats symlink loops like other errors: in strict mode, :exc:`OSError` is raised, and in non-strict mode, no exception is raised.

Attempts to pickle or create a shallow or deep copy of :mod:`codecs` streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError.

Add support of :class:`types.SimpleNamespace` in :func:`copy.replace`.

:mod:`pdb`: Replace :mod:`getopt` with :mod:`argparse` for parsing command line arguments.

Enable readline editing features in the :ref:`sqlite3 command-line interface <sqlite3-cli>` (python -m sqlite3).

Fix :func:`_thread.start_new_thread` race condition. If a thread is created during Python finalization, the newly spawned thread now exits immediately instead of trying to access freed memory and lead to a crash. Patch by Victor Stinner.

Enum: require names=() or type=... to create an empty enum using the functional syntax.

Exceptions raised by os.utime builtin function now include the related filename

Fix an issue in :func:`ast.unparse` when unparsing f-strings containing many quote types.

:func:`ast.unparse` now supports new :term:`f-string` syntax introduced in Python 3.12. Note that the :term:`f-string` quotes are reselected for simplicity under the new syntax. (Patch by Steven Sun)

Add :func:`copy.replace` function which allows to create a modified copy of an object. It supports named tuples, dataclasses, and many other objects.

Enum: raise :exc:`TypeError` if super().__new__() is called from a custom __new__.

Deprecate passing the callback callable by keyword for the following :class:`sqlite3.Connection` APIs:

The affected parameters will become positional-only in Python 3.15.

Patch by Erlend E. Aasland.

Fix concurrent.futures.ProcessPoolExecutor deadlock

Fix crashes related to use of weakrefs on :data:`typing.TypeVar`.

Make expressions/statements work as expected in pdb

Add :func:`os.timerfd_create`, :func:`os.timerfd_settime`, :func:`os.timerfd_gettime`, :func:`os.timerfd_settime_ns`, and :func:`os.timerfd_gettime_ns` to provide a low level interface for Linux's timer notification file descriptor.

:mod:`tarfile`: extraction of members with overly large UID or GID (e.g. on an OS with 32-bit :c:type:`!id_t`) now fails in the same way as failing to set the ID.

Fix support for virtual tables in :meth:`sqlite3.Connection.iterdump`. Patch by Aviv Palivoda.

Fix a regression introduced in GH-101251 for 3.12, resulting in an incorrect offset calculation in :meth:`gzip.GzipFile.seek`.

:func:`time.sleep` now raises an auditing event.

Deprecate passing name, number of arguments, and the callable as keyword arguments, for the following :class:`sqlite3.Connection` APIs:

The affected parameters will become positional-only in Python 3.15.

Patch by Erlend E. Aasland.

Speed-up NormalDist.samples() by using the inverse CDF method instead of calling random.gauss().

Add the ability for venv to create a .gitignore file which causes the created environment to be ignored by Git. It is on by default when venv is called via its CLI.

Harmonized the pure Python version of :class:`~collections.OrderedDict` with the C version. Now, both versions set up their internal state in __new__. Formerly, the pure Python version did the set up in __init__.

Fix bugs in the constructor of :mod:`sqlite3.Connection` and :meth:`sqlite3.Connection.close` where exceptions could be leaked. Patch by Erlend E. Aasland.

Fix dis module to properly report and display bytecode that do not have source lines.

:mod:`sqlite3` now emits an :exc:`ResourceWarning` if a :class:`sqlite3.Connection` object is not :meth:`closed <sqlite3.connection.close>` explicitly. Patch by Erlend E. Aasland.

The __module__ attribute on instances of :class:`functools.cached_property` is now set to the name of the module in which the cached_property is defined, rather than "functools". This means that doctests in cached_property docstrings are now properly collected by the :mod:`doctest` module. Patch by Tyler Smart.

Fix :func:`multiprocessing.set_forkserver_preload` to check the given list of modules names. Patch by Donghee Na.

Fixes :func:`os.path.normpath` to handle embedded null characters without truncating the path.

:mod:`xml.dom.minidom` now only quotes " in attributes.

:mod:`xml.dom.minidom` now preserves whitespaces in attributes.

Passing more than one positional argument to :func:`sqlite3.connect` and the :class:`sqlite3.Connection` constructor is deprecated. The remaining parameters will become keyword-only in Python 3.15. Patch by Erlend E. Aasland.

Add merge_extra parameter/feature to :class:`logging.LoggerAdapter`

Fix possible losses of errno and winerror values in :exc:`OSError` exceptions if they were cleared or modified by the cleanup code before creating the exception object.

:func:`tarfile.data_filter` now takes the location of symlinks into account when determining their target, so it will no longer reject some valid tarballs with LinkOutsideDestinationError.

Extend socket's netlink support to the FreeBSD platform.

Fix signatures of module-level generated functions in :mod:`turtle`.

:mod:`pydoc` is now able to show signatures which are not representable in Python, e.g. for getattr and dict.pop.

Deprecate passing optional arguments maxsplit, count and flags in module-level functions :func:`re.split`, :func:`re.sub` and :func:`re.subn` as positional. They should only be passed by keyword.

Speed up :func:`logging.getHandlerNames`.

Fix :meth:`doctest.DocTestFinder.find` in presence of class names with special characters. Patch by Gertjan van Zwieten.

Passing a callable object as an option value to a Tkinter image now raises the expected TclError instead of an AttributeError.

Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!tk_busy_current`, and :meth:`!tk_busy_status`.

Raise :exc:`ResourceWarning` when :class:`asyncio.StreamWriter` is not closed leading to memory leaks. Patch by Kumar Aditya.

Add :meth:`pathlib.Path.from_uri` classmethod.

Seems that in some conditions, OpenSSL will return SSL_ERROR_SYSCALL instead of SSL_ERROR_SSL when a certification verification has failed, but the error parameters will still contain ERR_LIB_SSL and SSL_R_CERTIFICATE_VERIFY_FAILED. We are now detecting this situation and raising the appropriate ssl.SSLCertVerificationError. Patch by Pablo Galindo

Fix :func:`types.get_original_bases` to only return :attr:`!__orig_bases__` if it is present on cls directly. Patch by James Hilton-Balfe.

Remove opcode.is_pseudo, opcode.MIN_PSEUDO_OPCODE and opcode.MAX_PSEUDO_OPCODE, which were added in 3.12, were never documented and were not intended to be used externally.

:data:`!opcode.ENABLE_SPECIALIZATION` (which was added in 3.12 but never documented or intended for external usage) is moved to :data:`!_opcode.ENABLE_SPECIALIZATION` where tests can access it.

tarfiles; Fixed use before assignment of self.exception for gzip decompression

Set :attr:`!__wrapped__` attribute in :func:`reprlib.recursive_repr`.

Implement new :meth:`__repr__` method for :class:`struct.Struct`. Now it returns Struct(<format repr>).

Optimize :func:`textwrap.indent`. It is ~30% faster for large input. Patch by Inada Naoki.

Fix issue where :meth:`pathlib.Path.iterdir` did not raise :exc:`OSError` until iterated.

Deprecate :class:`typing.AnyStr` in favor of the new Type Parameter syntax. See PEP 695.

Make :func:`gettext.pgettext` search plural definitions when translation is not found.

Shelves opened with :func:`shelve.open` have a much faster :meth:`clear` method. Patch by James Cave.

Fix overflow on 32-bit systems with :mod:`asyncio` :func:`os.sendfile` implementation.

Document behavior of :func:`shutil.disk_usage` for non-mounted filesystems on Unix.

Use lowercase mail from and rcpt to in :class:`smptlib.SMTP`.

Do not report MultipartInvariantViolationDefect defect when the :class:`email.parser.Parser` class is used to parse emails with headersonly=True.

Fix invalid result from :meth:`PurePath.relative_to` method when attempting to walk a ".." segment in other with walk_up enabled. A :exc:`ValueError` exception is now raised in this case.

Add the rtype_cache to the warning message (as an addition to the type of leaked objects and the number of leaked objects already included in the message) to make debugging leaked objects easier when the multiprocessing resource tracker process finds leaked objects at shutdown. This helps more quickly identify what was leaked and/or why the leaked object was not properly cleaned up.

Optimize :meth:`SelectSelector.select` for many iteration case. Patch By Donghee Na.

Optimize :meth:`!_PollLikeSelector.select` for many iteration case.

Optimize :meth:`KqueueSelector.select` for many iteration case. Patch By Donghee Na.

Fix potential missing NULL check of d2i_SSL_SESSION result in _ssl.c.

The various opcode lists in the :mod:`dis` module are now generated from bytecodes.c instead of explicitly constructed in opcode.py.

Make :func:`inspect.getsource` smarter for class for same name definitions

Remove import of :mod:`pprint` from :mod:`sysconfig`.

Added __slots__ to :class:`contextlib.AbstractContextManager` and :class:`contextlib.AbstractAsyncContextManager` so that child classes can use __slots__.

Update the bundled copy of pip to version 23.2.1.

:mod:`selectors`: Optimize EpollSelector.select() code by moving some code outside of the loop.

Fixed several bugs in zipfile.Path, including: in :meth:`zipfile.Path.match`, Windows separators are no longer honored (and never were meant to be); Fixed name/suffix/suffixes/stem operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior.

Remove call to SSL_CTX_set_session_id_context during client side context creation in the :mod:`ssl` module.

Disable tab completion in multiline mode of :mod:`pdb`

Expose opcode metadata through :mod:`!_opcode`.

Add the new exceptions command to the Pdb debugger. It makes it possible to move between chained exceptions when using post mortem debugging.

Add __copy__ and __deepcopy__ in :mod:`enum`

:mod:`selectors`: Add _SelectorMapping.get() method and optimize _SelectorMapping.__getitem__().

Speed up parsing of emails by about 20% by not compiling a new regular expression for every single email.

Set the environment variable VIRTUAL_ENV_PROMPT at :mod:`venv` activation, even when VIRTUAL_ENV_DISABLE_PROMPT is set.

Revert a change to :func:`colorsys.rgb_to_hls` that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy.

Fix exit code for unittest if all tests are skipped. Patch by Egor Eliseev.

Optimize (?!) (pattern which always fails) in regular expressions.

:mod:`selectors`: Reduce Selector overhead by using a dict.get() to lookup file descriptors.

Remove ref cycle in callers of :func:`~multiprocessing.managers.convert_to_error` by deleting result from scope in a finally block.

Add :attr:`pathlib.PurePath.pathmod` class attribute that stores the implementation of :mod:`os.path` used for low-level path operations: either posixpath or ntpath.

Reduce overhead to add and remove :mod:`asyncio` readers and writers.

Fix crash in :func:`!_sre.template` with templates containing invalid group indices.

Removed _legacy and the names it provided from importlib.resources: Resource, contents, is_resource, open_binary, open_text, path, read_binary, and read_text.

:mod:`re` module: fix the matching of possessive quantifiers in the case of a subpattern containing backtracking.

Improve debug output for atomic groups in regular expressions.

Fix ref cycle in :class:`!asyncio._SelectorSocketTransport` by removing _write_ready in close.

Fix flag mask inversion when unnamed flags exist.

Prevent :mod:`multiprocessing.spawn` from failing to import in environments where sys.executable is None. This regressed in 3.11 with the addition of support for path-like objects in multiprocessing.

Instances of :class:`typing.TypeVar`, :class:`typing.ParamSpec`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, and :class:`typing.TypeVarTuple` once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra.

Add private pathlib._PathBase class, which provides experimental support for virtual filesystems, and may be made public in a future version of Python.

Check for an instance-dict cached value in the :meth:`__get__` method of :func:`functools.cached_property`. This better matches the pre-3.12 behavior and improves compatibility for users subclassing :func:`functools.cached_property` and adding a :meth:`__set__` method.

Detect possible memory allocation failure in the libtommath function :c:func:`mp_init` used by the _tkinter module.

Fix incorrect matching of empty paths in :meth:`pathlib.PurePath.match`. This bug was introduced in Python 3.12.0 beta 1.

Deprecate :func:`typing.no_type_check_decorator`. No major type checker ever added support for this decorator. Patch by Alex Waygood.

Make :func:`pydoc.doc` catch bad module :exc:`ImportError` when output stream is not None.

Fix crash when calling repr with a manually constructed SignalDict object. Patch by Charlie Zhao.

Replace assert statements with raise RuntimeError in :mod:`threading`, so that _DummyThread cannot be joined even with -OO.

Fix rare concurrency bug in lock acquisition by the logging package.

Added PY_THROW event hook for :mod:`cProfile` for generators

Added asyncio.taskgroups.__all__ to asyncio.__all__ for export in star imports.

Zipapp will now skip over appending an archive to itself.

Improve the error message from :func:`os.fspath` if called on an object where __fspath__ is set to None. Patch by Alex Waygood.

Fix crash due to improper reference counting in :mod:`asyncio` eager task factory internal routines.

Fix bug where a :class:`typing.Protocol` class that had one or more non-callable members would raise :exc:`TypeError` when :func:`issubclass` was called against it, even if it defined a custom __subclasshook__ method. The behaviour in Python 3.11 and lower -- which has now been restored -- was not to raise :exc:`TypeError` in these situations if a custom __subclasshook__ method was defined. Patch by Alex Waygood.

Reverted addition of json.AttrDict.

Add :exc:`pathlib.UnsupportedOperation`, which is raised instead of :exc:`NotImplementedError` when a path operation isn't supported.

Fix a regression introduced in GH-101251 for 3.12, causing :meth:`gzip.GzipFile.flush` to not flush the compressor (nor pass along the zip_mode argument).

:func:`~dis.stack_effect` no longer raises an exception if an oparg is provided for an opcode that doesn't use its arg, or when it is not provided for an opcode that does use it. In the latter case, the stack effect is returned for oparg=0.

Enable :func:`ast.unparse` to unparse function and class definitions created without the new type_params field from PEP 695. Patch by Jelle Zijlstra.

Add follow_symlinks keyword-only argument to :meth:`pathlib.Path.is_dir` and :meth:`~pathlib.Path.is_file`, defaulting to True.

Deprecate two methods of creating :class:`typing.TypedDict` classes with 0 fields using the functional syntax: TD = TypedDict("TD") and TD = TypedDict("TD", None). Both will be disallowed in Python 3.15. To create a TypedDict class with 0 fields, either use class TD(TypedDict): pass or TD = TypedDict("TD", {}).

Fix webbrowser.Konqueror.open method.

:mod:`ctypes`: Deprecate undocumented :func:`!ctypes.SetPointerType` and :func:`!ctypes.ARRAY` functions. Patch by Victor Stinner.

Remove deprecated re.template, re.T, re.TEMPLATE, sre_constans.SRE_FLAG_TEMPLATE.

Supporting :meth:`asyncio.Task.set_name` is now mandatory for third party task implementations. The undocumented :func:`!_set_task_name` function (deprecated since 3.8) has been removed. Patch by Kumar Aditya.

Fix a bug in :c:func:`!_Unpickler_SetInputStream` where an exception could end up being overwritten in case of failure.

Change the default return value of :meth:`http.client.HTTPConnection.get_proxy_response_headers` to be None and not {}.

Fix bugs in :mod:`sys` where exceptions could end up being overwritten because of deferred error handling.

Harden :mod:`pyexpat` error handling during module initialisation to prevent exceptions from possibly being overwritten, and objects from being dereferenced twice.

Fix bug in :mod:`decimal` where an exception could end up being overwritten.

Fix bugs in :mod:`!_datetime` where exceptions could be overwritten in case of module initialisation failure.

Fix bugs in :mod:`!_ssl` initialisation which could lead to leaked references and overwritten exceptions.

Fix a bug in :class:`array.array` where an exception could end up being overwritten.

Fix bugs in :mod:`!_ctypes` where exceptions could end up being overwritten.

Fix a bug in the :mod:`posix` module where an exception could be overwritten.

Fix bugs in :mod:`!_elementtree` where exceptions could be overwritten.

Fix bugs in :mod:`zoneinfo` where exceptions could be overwritten.

Fix bugs in :mod:`errno` where exceptions could be overwritten.

Deprecate creating a :class:`typing.NamedTuple` class using keyword arguments to denote the fields (NT = NamedTuple("NT", x=int, y=str)). This will be disallowed in Python 3.15. Use the class-based syntax or the functional syntax instead.

Two methods of creating NamedTuple classes with 0 fields using the functional syntax are also deprecated, and will be disallowed in Python 3.15: NT = NamedTuple("NT") and NT = NamedTuple("NT", None). To create a NamedTuple class with 0 fields, either use class NT(NamedTuple): pass or NT = NamedTuple("NT", []).

Remove deprecated in 3.11 webbrowser.MacOSXOSAScript._name attribute.

Fix flag inversion when alias/mask members exist.

:data:`typing.Annotated` is now implemented as an instance of typing._SpecialForm rather than a class. This should have no user-facing impact for users of the :mod:`typing` module public API.

Fix bugs in :mod:`pickle` where exceptions could be overwritten.

Emit :exc:`FutureWarning` from :meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` if the given pattern ends with "**". In a future Python release, patterns with this ending will match both files and directories. Add a trailing slash to only match directories.

Fix a bug in :mod:`sqlite3` where an exception could be overwritten in the :meth:`collation <sqlite3.Connection.create_collation>` callback.

Remove cafile, capath and cadefault parameters of the :func:`urllib.request.urlopen` function, deprecated in Python 3.6. Patch by Victor Stinner.

:mod:`logging`: Remove undocumented and untested Logger.warn() and LoggerAdapter.warn() methods and logging.warn() function. Deprecated since Python 3.3, they were aliases to the :meth:`logging.Logger.warning` method, :meth:`!logging.LoggerAdapter.warning` method and :func:`logging.warning` function. Patch by Victor Stinner.

Revert pickling method from by-name back to by-value.

Add RTSPS scheme support in urllib.parse

Add option to :func:`traceback.format_exception_only` to recurse into the nested exception of a :exc:`BaseExceptionGroup`.

Fix bug where isinstance([], collections.abc.Mapping) could evaluate to True if garbage collection happened at the wrong time. The bug was caused by changes to the implementation of :class:`typing.Protocol` in Python 3.12.

:mod:`array`: Add 'w' typecode that represents Py_UCS4.

Fix longstanding bug where issubclass(object, typing.Protocol) would evaluate to True in some edge cases. Patch by Alex Waygood.

In the beta 1 release we added a utility function for extension module authors, to use when testing their module for support in multiple interpreters or under a per-interpreter GIL. The name of that function has changed from allowing_all_extensions to _incompatible_extension_module_restrictions. The default for the "disable_check" argument has change from True to False, to better match the new function name.

Fixed inconsistent signature on derived classes for :func:`inspect.signature`

Fix a recent regression in the :mod:`typing` module. The regression meant that doing class Foo(X, typing.Protocol), where X was a class that had :class:`abc.ABCMeta` as its metaclass, would then cause subsequent isinstance(1, X) calls to erroneously raise :exc:`TypeError`. Patch by Alex Waygood.

The :class:`io.IOBase` finalizer now logs the close() method errors with :data:`sys.unraisablehook`. Previously, errors were ignored silently by default, and only logged in :ref:`Python Development Mode <devmode>` or on :ref:`Python built on debug mode <debug-build>`. Patch by Victor Stinner.

:mod:`wave`: Deprecate the getmark(), setmark() and getmarkers() methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. They will be removed in Python 3.15. Patch by Victor Stinner.

Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit` method, deprecated in Python 3.11. Patch by Hugo van Kemenade.

Improve performance of :class:`pathlib.PurePath` initialisation by deferring joining of paths when multiple arguments are given.

Deprecate undocumented copy/deepcopy/pickle support for itertools.

Fix pathlib.PurePosixPath(pathlib.PureWindowsPath(...)) not converting path separators to restore 3.11 compatible behavior.

Make comparisons between :class:`pathlib.PureWindowsPath` objects consistent across Windows and Posix to match 3.11 behavior.

PEP 594: Remove the :mod:`!audioop` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!aifc` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!uu` module, deprecated in Python 3.11. Patch by Victor Stinner.

Fix bugs with the interaction between :func:`typing.runtime_checkable` and :class:`typing.Generic` that were introduced by the PEP 695 implementation. Patch by Jelle Zijlstra.

PEP 594: Remove the :mod:`!crypt` module and its private :mod:`!_crypt` extension, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!nis` module, deprecated in Python 3.11. Patch by Victor Stinner.

Add missing :attr:`~object.__slots__` to :class:`os.PathLike`.

PEP 594: Remove the :mod:`!xdrlib` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!nntplib` module, deprecated in Python 3.11. Patch by Victor Stinner.

Remove the undocumented :class:`!configparser.LegacyInterpolation` class, deprecated in the docstring since Python 3.2, and with a deprecation warning since Python 3.11. Patch by Hugo van Kemenade.

Remove kwargs-based :class:`typing.TypedDict` creation

Remove the :meth:`!turtle.RawTurtle.settiltangle` method, deprecated in docs since Python 3.1 and with a deprecation warning since Python 3.11. Patch by Hugo van Kemenade.

PEP 594: Removed the :mod:`!msilib` package, deprecated in Python 3.11.

PEP 594: Remove the :mod:`!spwd` module, deprecated in Python 3.11: the :pypi:`python-pam` project can be used instead. Patch by Victor Stinner.

Removed the tkinter.tix module, deprecated since Python 3.6.

PEP 594: Remove the :mod:`!chunk` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!mailcap` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!sunau` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!ossaudiodev` module, deprecated in Python 3.11. Patch Victor Stinner.

PEP 594: Remove the :mod:`!pipes` module, deprecated in Python 3.11. Patch by Victor Stinner.

Add :func:`typing.get_protocol_members` to return the set of members defining a :class:`typing.Protocol`. Add :func:`typing.is_protocol` to check whether a class is a :class:`typing.Protocol`. Patch by Jelle Zijlstra.

Document the __name__ and __supertype__ attributes of :class:`typing.NewType`. Patch by Jelle Zijlstra.

Removed the following :mod:`unittest` functions, deprecated in Python 3.11:

Use :class:`~unittest.TestLoader` methods instead:

Patch by Hugo van Kemenade.

Remove the untested and undocumented :mod:`webbrowser` :class:`!MacOSX` class, deprecated in Python 3.11. Patch by Hugo van Kemenade.

Support for using :class:`pathlib.Path` objects as context managers has been removed. Before Python 3.9, exiting the context manager marked a path as "closed", which caused some (but not all!) methods to raise when called. Since Python 3.9, using a path as a context manager does nothing.

Adjust the location of the (see PEP 695) type_params field on :class:`ast.ClassDef`, :class:`ast.AsyncFunctionDef`, and :class:`ast.FunctionDef` to better preserve backward compatibility. Patch by Jelle Zijlstra

Allow :class:`typing.Protocol` classes to inherit from :class:`collections.abc.Buffer`. Patch by Jelle Zijlstra.

Remove locale.resetlocale() function deprecated in Python 3.11. Patch by Victor Stinner.

Remove the 2to3 program and the :mod:`!lib2to3` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!telnetlib` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!imghdr` module, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!cgi` and :mod:`!cgitb` modules, deprecated in Python 3.11. Patch by Victor Stinner.

PEP 594: Remove the :mod:`!sndhdr` module, deprecated in Python 3.11. Patch by Victor Stinner.

On Linux where :mod:`subprocess` can use the vfork() syscall for faster spawning, prevent the parent process from blocking other threads by dropping the GIL while it waits for the vfork'ed child process exec() outcome. This prevents spawning a binary from a slow filesystem from blocking the rest of the application.

We now release the GIL around built-in :mod:`hashlib` computations of reasonable size for the SHA families and MD5 hash functions, matching what our OpenSSL backed hash computations already does.

Improve performance of :meth:`pathlib.Path.glob` when expanding a pattern with a non-terminal "**" component by filtering walked paths through a regular expression, rather than calling :func:`os.scandir` more than once on each directory.

Prepare the _tkinter module for building with Tcl 9.0 and future libtommath by replacing usage of deprecated functions :c:func:`mp_to_unsigned_bin_n` and :c:func:`mp_unsigned_bin_size` when necessary.

Add fields start_offset, cache_offset, end_offset, baseopname, baseopcode, jump_target and oparg to :class:`dis.Instruction`.

Fixed parent argument validation mechanism of :mod:`argparse`. Improved test coverage.

Provide helpful usage messages when parsing incorrect :mod:`pdb` commands.

Generalize the regex pattern BaseConfigurator.INDEX_PATTERN to allow spaces and non-alphanumeric characters in keys.

Added multiline statement support for :mod:`pdb`

Forbid using :func:`builtins.issubclass` with :class:`types.GenericAlias` as the first argument.

Fix cache repopulation semantics of zipimport.invalidate_caches(). The cache is now repopulated upon retrieving files with an invalid cache, not when the cache is invalidated.

Fix a bug that causes wrong matches for regular expressions with possessive qualifier.

Add follow_symlinks argument to :meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob`, defaulting to false.

Hide traceback in :func:`help` prompt, when import failed.

Added a stream mode to tarfile that allows for reading archives without caching info about the inner files.

Deprecate passing any arguments to :func:`threading.RLock`.

Refactored zipfile._strip_extra to use higher level abstractions for extras instead of a heavy-state loop.

Reduce calls of _idle_semaphore.release() in :func:`concurrent.futures.thread._worker`.

Add support for recursive wildcards in :meth:`pathlib.PurePath.match`.

:class:`unittest.TestLoader` no longer loads test cases from exact :class:`unittest.TestCase` and :class:`unittest.FunctionTestCase` classes.

Restore following CPython <= 3.10.5 behavior of :func:`shutil.make_archive`: do not create an empty archive if root_dir is not a directory, and, in that case, raise :class:`FileNotFoundError` or :class:`NotADirectoryError` regardless of format choice. Beyond the brought-back behavior, the function may now also raise these exceptions in dry_run mode.

Emit :exc:`DeprecationWarning` for :mod:`array`'s 'u' type code, deprecated in docs since Python 3.3.

:func:`unittest.mock.create_autospec` now properly returns coroutine functions compatible with :func:`inspect.iscoroutinefunction`

Fix hanging :mod:`multiprocessing` ProcessPoolExecutor when a child process crashes while data is being written in the call queue.

Remove the typing.io and typing.re namespaces, deprecated since Python 3.8. All items are still available from the main :mod:`typing` module.

Improve the textual representation of IPv4-mapped IPv6 addresses (RFC 4291 Sections 2.2, 2.5.5.2) in :mod:`ipaddress`. Patch by Oleksandr Pavliuk.

Improve performance of :func:`operator.methodcaller` using the PEP 590 vectorcall convention. Patch by Anthony Lee and Pieter Eendebak.

:func:`unittest.mock.mock_open` will call the :func:`close` method of the file handle mock when it is exiting from the context manager. Patch by Samet Yaslan.

Improve performance of :class:`functools.singledispatchmethod` by caching the generated dispatch wrapper. Optimization suggested by frederico. Patch by @mental32, Alex Waygood and Pieter Eendebak.

:mod:`unittest.mock` speccing no longer calls class properties. Patch by Melanie Witt.

Ensure gettext(msg) retrieve translations even if a plural form exists. In other words: gettext(msg) == ngettext(msg, '', 1).

Add ThreadingMock to :mod:`unittest.mock` that can be used to create Mock objects that can wait until they are called. Patch by Karthikeyan Singaravelan and Mario Corchero.

The minimum Sphinx version required for the documentation is now 4.2.

:mod:`dis` module command-line interface is now mentioned in documentation.

Add documentation for :c:type:`PyInterpreterConfig` and :c:func:`Py_NewInterpreterFromConfig`. Also clarify some of the nearby docs relative to per-interpreter GIL.

Document the :mod:`curses` module variables :const:`~curses.LINES` and :const:`~curses.COLS`.

Add a number of standard external names to nitpick_ignore.

Make timeit doc command lines compatible with Windows by using double quotes for arguments. This works on linux and macOS also.

Fixed :func:`functools.lru_cache` docstring accounting for typed argument's different handling of str and int. Patch by Bar Harel.

Update timeit doc to specify that time in seconds is just the default.

Add missing documentation for the max_group_depth and max_group_width parameters and the exceptions attribute of the :class:`traceback.TracebackException` class.

Add missing documentation for the end_lineno and end_offset attributes of the :class:`traceback.TracebackException` class.

Remove mentions of old Python versions in :class:`typing.NamedTuple`.

Add documentation on how to localize the :mod:`argparse` module.

Document the return type of x // y when x and y have type :class:`float`.

Align function signature for functools.reduce in documentation and docstring with the C implementation.

Fix test_stress_modifying_handlers() of test_signal. Patch by Victor Stinner.

Fix test_tools.test_freeze on FreeBSD: run "make distclean" instead of "make clean" in the copied source directory to remove also the "python" program. Patch by Victor Stinner.

Fix a deadlock in test_socket when server fails with a timeout but the client is still running in its thread. Don't hold a lock to call cleanup functions in doCleanups(). One of the cleanup function waits until the client completes, whereas the client could deadlock if it called addCleanup() in such situation. Patch by Victor Stinner.

Add tests for :mod:`tty`.

Add tests for :mod:`termios`.

regrtest: When using worker processes (-jN) with --verbose3 option, regrtest can now display the worker output even if a worker process does crash. Previously, sys.stdout and sys.stderr were replaced and so the worker output was lost on a crash. Patch by Victor Stinner.

Add tests for pickling and copying PyStructSequence objects. Patched by Xuehai Pan.

libregrtest now always sets and shows random.seed, so tests are more reproducible. Use --randseed flag to pass the explicit random seed for tests.

Remove Tools/scripts/run_tests.py and make hostrunnertest. Just run ./python -m test --slow-ci, make buildbottest or make test instead. Python test runner (regrtest) now handles cross-compilation and HOSTRUNNER. It also adds options to Python such fast -u -E -W default -bb when --fast-ci or --slow-ci option is used. Patch by Victor Stinner.

Skip test_threading tests using thread+fork if Python is built with Address Sanitizer (ASAN). Patch by Victor Stinner.

Fix test_asyncio timeouts: don't measure the maximum duration, a test should not measure a CI performance. Only measure the minimum duration when a task has a timeout or delay. Add CLOCK_RES to test_asyncio.utils. Patch by Victor Stinner.

Fix race conditions in test_threading lock tests. Wait until a condition is met rather than using :func:`time.sleep` with a hardcoded number of seconds. Patch by Victor Stinner.

Fix test_interprocess_signal() of test_signal. Make sure that the subprocess.Popen object is deleted before the test raising an exception in a signal handler. Otherwise, Popen.__del__() can get the exception which is logged as Exception ignored in: ... and the test fails. Patch by Victor Stinner.

Fix test_timeout() of test_concurrent_futures.test_wait. Remove the future which may or may not complete depending if it takes longer than the timeout or not. Keep the second future which does not complete before wait() timeout. Patch by Victor Stinner.

Split test_gdb.py file into a test_gdb package made of multiple tests, so tests can now be run in parallel. Patch by Victor Stinner.

regrtest: When --fast-ci or --slow-ci option is used, regrtest now replaces the current process with a new process to add -u -W default -bb -E options to Python. Patch by Victor Stinner.

Fix test_zippath_from_non_installed_posix() of test_venv: don't copy __pycache__/ sub-directories, because they can be modified by other Python tests running in parallel. Patch by Victor Stinner.

regrtest: Fix reference leak check on Windows. Disable the load tracker on Windows in the reference leak check mode (-R option). Patch by Victor Stinner.

regrtest: When a test fails with "env changed" and the --rerun option is used, the test is now re-run in verbose mode in a fresh process. Patch by Victor Stinner.

Skip test_freeze_simple_script() of test_tools.test_freeze if Python is built with ./configure --enable-optimizations, which means with Profile Guided Optimization (PGO): it just makes the test too slow. The freeze tool is tested by many other CIs with other (faster) compiler flags. Patch by Victor Stinner.

Skip test_perf_profiler if Python is built with ASAN, MSAN or UBSAN sanitizer. Python does crash randomly in this test on such build. Patch by Victor Stinner.

regrtest: Add --fast-ci and --slow-ci options. --fast-ci uses a default timeout of 10 minutes and -u all,-cpu (skip slowest tests). --slow-ci uses a default timeout of 20 minutes and -u all (run all tests). Patch by Victor Stinner.

libregrtest now decodes stdout of test worker processes with the "backslashreplace" error handler to log corrupted stdout, instead of failing with an error and not logging the stdout. Patch by Victor Stinner.

Fix test_socket.test_hmac_sha1() in FIPS mode. Use a longer key: FIPS mode requires at least of at least 112 bits. The previous key was only 32 bits. Patch by Victor Stinner.

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex: Fedora 38). Search patterns in gdb "bt" command output to detect when gdb fails to retrieve the traceback. For example, skip a test if Backtrace stopped: frame did not save the PC is found. Patch by Victor Stinner.

libregrtest now calls :func:`random.seed` before running each test file when -r/--randomize command line option is used. Moreover, it's also called in worker processes. It should help to make tests more deterministic. Previously, it was only called once in the main process before running all test files and it was not called in worker processes. Patch by Victor Stinner.

libregrtest now uses a separated file descriptor to write test result as JSON. Previously, if a test wrote debug messages late around the JSON, the main test process failed to parse JSON. Patch by Victor Stinner.

Fix and enable test_msvcrt.

Fix test_site.test_underpth_basic() when the working directory contains at least one non-ASCII character: encode the ._pth file to UTF-8 and enable the UTF-8 Mode to use UTF-8 for the child process stdout. Patch by Victor Stinner.

Fix test_pyexpat.test_exception(): it can now be run from a directory different than Python source code directory. Before, the test failed in this case. Skip the test if Modules/pyexpat.c source is not available. Skip also the test on Python implementations other than CPython. Patch by Victor Stinner.

Add tests for msvcrt.

Fix test_asyncio, test_imaplib and test_socket tests on FreeBSD if the TCP blackhole is enabled (sysctl net.inet.tcp.blackhole). Skip the few tests which failed with ETIMEDOUT which such non standard configuration. Currently, the FreeBSD GCP image enables TCP and UDP blackhole (sysctl net.inet.tcp.blackhole=2 and sysctl net.inet.udp.blackhole=1). Patch by Victor Stinner.

Skip test_gdb if gdb is unable to retrieve Python frame objects: if a frame is <optimized out>. When Python is built with "clang -Og", gdb can fail to retrieve the frame parameter of _PyEval_EvalFrameDefault(). In this case, tests like py_bt() are likely to fail. Without getting access to Python frames, python-gdb.py is mostly clueless on retrieving the Python traceback. Moreover, test_gdb is no longer skipped on macOS if Python is built with Clang. Patch by Victor Stinner.

Skip test_tempfile.test_flags() if chflags() fails with "OSError: [Errno 45] Operation not supported" (ex: on FreeBSD 13). Patch by Victor Stinner.

FreeBSD 13.2 CI coverage for pull requests is now provided by Cirrus-CI (a hosted CI service that supports Linux, macOS, Windows, and FreeBSD).

Removed support of test_main() function in tests. They now always use normal unittest test runner.

Fix test_tomllib recursion tests for WASI buildbots: reduce the recursion limit and compute the maximum nested array/dict depending on the current available recursion limit. Patch by Victor Stinner.

Add get_recursion_available() and get_recursion_depth() functions to the :mod:`test.support` module. Patch by Victor Stinner.

Add --fail-rerun option option to regrtest: if a test failed when then passed when rerun in verbose mode, exit the process with exit code 2 (error), instead of exit code 0 (success). Patch by Victor Stinner.

Rename regrtest --verbose2 option (-w) to --rerun. Keep --verbose2 as a deprecated alias. Patch by Victor Stinner.

When regrtest reruns failed tests in verbose mode (./python -m test --rerun), tests are now rerun in fresh worker processes rather than being executed in the main process. If a test does crash or is killed by a timeout, the main process can detect and handle the killed worker process. Tests are rerun in parallel if the -jN option is used to run tests in parallel. Patch by Victor Stinner.

regrtest now computes statistics on all tests: successes, failures and skipped. test_netrc, test_pep646_syntax and test_xml_etree now return results in their test_main() function. Patch by Victor Stinner and Alex Waygood.

The :meth:`doctest.DocTestRunner.run` method now counts the number of skipped tests. Add :attr:`doctest.DocTestRunner.skips` and :attr:`doctest.TestResults.skipped` attributes. Patch by Victor Stinner.

Convert test_concurrent_futures to a package of 7 sub-tests. Patch by Victor Stinner.

Split test_multiprocessing_fork, test_multiprocessing_forkserver and test_multiprocessing_spawn into test packages. Each package is made of 4 sub-tests: processes, threads, manager and misc. It allows running more tests in parallel and so reduce the total test duration. Patch by Victor Stinner.

Fix test_cppext when the C compiler command -std=c11 option: remove -std= options from the compiler command. Patch by Victor Stinner.

Set up CIFuzz to run fuzz targets in GitHub Actions. Patch by Illia Volochii.

test_logging: Fix test_udp_reconnection() by increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner.

Add the C API test for functions in the Mapping Protocol, the Sequence Protocol and some functions in the Object Protocol.

test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport. Patch by Victor Stinner.

Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`.

Moved tests for zipfile.Path into Lib/test/test_zipfile/_path. Made zipfile._path a package.

Add .coveragerc to cpython repository for use with coverage package.

When running the Python test suite with -jN option, if a worker stdout cannot be decoded from the locale encoding report a failed testn so the exitcode is non-zero. Patch by Victor Stinner.

When the Python build is configured --with-wheel-pkg-dir, tests requiring the setuptools and wheel wheels will search for the wheels in WHEEL_PKG_DIR.

String tests are modified to reflect that str and unicode are merged in Python 3. Patch by Daniel Fortunov.

Suppress and assert expected RuntimeWarnings in test_sys_settrace.py

Add additional tests to :mod:`calendar` to achieve full test coverage.

"make check-clean-src" now also checks if the "python" program is found in the source directory: fail with an error if it does exist. Patch by Victor Stinner.

Fix compile error when building with recent versions of libedit.

No longer ignore :envvar:`PROFILE_TASK` failure silently: command used by Profile Guided Optimization (PGO). Patch by Victor Stinner.

Remove make testall target: use make buildbottest instead. Patch by Victor Stinner.

The experimental --disable-gil configure flag now includes "t" (for "threaded") in extension ABI tags.

Fix building the _testcapi extension on Linux AArch64 which requires linking to libatomic when <cpython/pyatomic.h> is used: the _Py_atomic_or_uint64() function requires libatomic __atomic_fetch_or_8() on this platform. The configure script now checks if linking to libatomic is needed and generates a new LIBATOMIC variable used to build the _testcapi extension. Patch by Victor Stinner.

Fix Solaris build: no longer redefine the gethostname() function. Solaris defines the function since 2005. Patch by Victor Stinner, original patch by Jakub Kulík.

Fix a race condition in make regen-all. The deepfreeze.c source and files generated by Argument Clinic are now generated or updated before generating "global objects". Previously, some identifiers may miss depending on the order in which these files were generated. Patch by Victor Stinner.

Python built with :file:`configure` :option:`--with-trace-refs` (tracing references) is now ABI compatible with Python release build and :ref:`debug build <debug-build>`. Patch by Victor Stinner.

The _stat C extension is now built with the :ref:`limited C API <limited-c-api>`. Patch by Victor Stinner.

Fix x86_64 GNU/Hurd build

When calling find_python.bat with -q it did not properly silence the output of nuget. That is now fixed.

Remove the make target regen-opcode-targets, merge its work into regen-opcode which repeats most of the calculation. This simplifies the code for the build and reduces code duplication.

Check for linux/limits.h before including it in Modules/posixmodule.c.

Refactor platform triplet detection code and add detection for MIPS soft float and musl libc.

Detect MPI compilers in :file:`configure`.

Fix compilation for platforms without :data:`!O_CLOEXEC`. The issue was introduced with Python 3.12b1 in :gh:`103295`. Patch by Erlend Aasland.

SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension module. Patch by Erlend Aasland.

Fix a regression in :file:`configure` where we could end up unintentionally linking with libbsd.

Document how to perform a WASI build on Linux. Also add Tools/wasm/build_wasi.sh as a reference implementation of the docs.

Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:`configure`.

Include commoninstall as a prerequisite for bininstall

This ensures that commoninstall is completed before bininstall is started when parallel builds are used (make -j install), and so the python3 symlink is only installed after all standard library modules are installed.

Add experimental wasi-threads support. Patch by Takashi Yamamoto.

Allows overriding the source of VC redistributables so that releases can be guaranteed to never downgrade between updates.

Update Windows installer to use SQLite 3.43.1.

:func:`os.path.realpath` now resolves MS-DOS style file names even if the file is not accessible. Patch by Moonsik Park.

Update Windows build to use OpenSSL 3.0.11.

Fixes :func:`~os.path.realpath` to behave consistently when passed a path containing an embedded null character on Windows. In strict mode, it now raises :exc:`OSError` instead of the unexpected :exc:`ValueError`, and in non-strict mode will make the path absolute.

Changes the :ref:`launcher` to prefer an active virtual environment when the launched script has a shebang line using a Unix-like virtual command, even if the command requests a specific version of Python.

Fix integer overflow and truncating by the null character in :func:`!_winapi.LCMapStringEx` which affects :func:`ntpath.normcase`.

Ensure that an empty environment block is terminated by two null characters, as is required by Windows.

Updated the links at the end of the installer to point to Discourse rather than the mailing lists.

When installed from the Microsoft Store, pip no longer defaults to per-user installs. However, as the install directory is unwritable, it should automatically decide to do a per-user install anyway. This should resolve issues when pip is passed an option that conflicts with --user.

Improve performance of :func:`shutil.copy2` by using the operating system's CopyFile2 function. This may result in subtle changes to metadata copied along with some files, bringing them in line with normal OS behavior.

Fixes :func:`~os.stat` and related functions on file systems that do not support file ID requests. This includes FAT32 and exFAT.

Add :func:`os.path.isdevdrive` to detect whether a path is on a Windows Dev Drive. Returns False on platforms that do not support Dev Drive, and is absent on non-Windows platforms.

Update macOS installer to use SQLite 3.43.1.

Update macOS installer to use OpenSSL 3.0.11.

Update macOS installer to use OpenSSL 3.0.9.

Remove IDLE's modification of tokenize.tabsize and test other uses of tokenize data and methods.

Update GitHub CI workflows to use OpenSSL 3.0.11 and multissltests to use 1.1.1w, 3.0.11, and 3.1.3.

Argument Clinic now has a partial support of the :ref:`Limited API <limited-c-api>`: see documentation in the Python Developer's Guide Patch by Victor Stinner.

It is now possible to deprecate passing keyword arguments for keyword-or-positional parameters with Argument Clinic, using the new / [from X.Y] syntax. (To be read as "positional-only from Python version X.Y".) See documentation in the Python Developer's Guide for more information.

Argument Clinic can now clone :meth:`!__init__` and :meth:`!__new__` methods.

Add --exclude option to Argument Clinic CLI.

Argument Clinic now supports overriding automatically generated signature by using directive @text_signature. See documentation in the Python Developer's Guide

Fix duplicate module check in Argument Clinic. Previously, a duplicate definition would incorrectly be silently accepted. Patch by Erlend E. Aasland.

The Argument Clinic command-line tool now prints to stderr instead of stdout on failure.

Fix bugs in the Argument Clinic destination <name> clear command; the destination buffers would never be cleared, and the destination directive parser would simply continue to the fault handler after processing the command. Patch by Erlend E. Aasland.

Change bytecode syntax for families to remove redundant name matching pseudo syntax.

Argument Clinic now explicitly forbids "kwarg splats" in function calls used as annotations.

freeze now fetches CONFIG_ARGS from the original CPython instance the Makefile uses to call utility scripts. Patch by Ijtaba Hussain.

It is now possible to deprecate passing parameters positionally with Argument Clinic, using the new * [from X.Y] syntax. (To be read as "keyword-only from Python version X.Y".) See documentation in the Python Developer's Guide for more information. Patch by Erlend E. Aasland with help from Alex Waygood, Nikita Sobolev, and Serhiy Storchaka.

If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!Py_BUILD_CORE_MODULE` macros are now undefined by <Python.h>. Patch by Victor Stinner.

Add :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:`PyUnicode_EqualToUTF8` functions.

Raise :exc:`TypeError` for duplicate/unknown fields in PyStructSequence constructor. Patched by Xuehai Pan.

Remove undocumented PY_TIMEOUT_MAX constant from the limited C API. Patch by Victor Stinner.

:c:func:`PyImport_GetImporter` now sets RuntimeError if it fails to get :data:`sys.path_hooks` or :data:`sys.path_importer_cache` or they are not list and dict correspondingly. Previously it could return NULL without setting error in obscure cases, crash or raise SystemError if these attributes have wrong type.

Add :c:type:`PyMutex` internal-only lightweight locking API.

Add :c:func:`PySys_AuditTuple` function: similar to :c:func:`PySys_Audit`, but pass event arguments as a Python :class:`tuple` object. Patch by Victor Stinner.

Add :c:func:`PyThreadState_GetUnchecked()` function: similar to :c:func:`PyThreadState_Get()`, but don't kill the process with a fatal error if it is NULL. The caller is responsible to check if the result is NULL. Previously, the function was private and known as _PyThreadState_UncheckedGet(). Patch by Victor Stinner.

Python.h no longer includes the <ctype.h> standard header file. If needed, it should now be included explicitly. For example, it provides isalpha() and tolower() functions which are locale dependent. Python provides locale independent functions, like :c:func:`!Py_ISALPHA` and :c:func:`!Py_TOLOWER`. Patch by Victor Stinner.

Python.h no longer includes the <unistd.h> standard header file. If needed, it should now be included explicitly. For example, it provides the functions: close(), getpagesize(), getpid() and sysconf(). Patch by Victor Stinner.

Python.h no longer includes the <ieeefp.h> standard header. It was included for the finite() function which is now provided by the <math.h> header. It should now be included explicitly if needed. Remove also the HAVE_IEEEFP_H macro. Patch by Victor Stinner.

Python.h no longer includes these standard header files: <time.h>, <sys/select.h> and <sys/time.h>. If needed, they should now be included explicitly. For example, <time.h> provides the clock() and gmtime() functions, <sys/select.h> provides the select() function, and <sys/time.h> provides the futimes(), gettimeofday() and setitimer() functions. Patch by Victor Stinner.

Add functions :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyMapping_HasKeyWithError` and :c:func:`PyMapping_HasKeyStringWithError`.

Add :c:func:`PyObject_VisitManagedDict` and :c:func:`PyObject_ClearManagedDict` functions which must be called by the traverse and clear functions of a type using :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag. Patch by Victor Stinner.

Python built with :file:`configure` :option:`--with-trace-refs` (tracing references) now supports the :ref:`Limited API <limited-c-api>`. Patch by Victor Stinner.

Add :c:func:`PyLong_AsInt` function: similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:`int` instead of a C :c:expr:`long`. Previously, it was known as the private function :c:func:`!_PyLong_AsInt` (with an underscore prefix). Patch by Victor Stinner.

Add :c:func:`PyDict_ContainsString` function: same as :c:func:`PyDict_Contains`, but key is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. Patch by Victor Stinner.

Add atomic operations on additional data types in pyatomic.h.

Add :c:func:`Py_IsFinalizing` function: check if the main Python interpreter is :term:`shutting down <interpreter shutdown>`. Patch by Victor Stinner.

C API functions :c:func:`PyErr_SetFromErrnoWithFilename`, :c:func:`PyErr_SetExcFromWindowsErrWithFilename` and :c:func:`PyErr_SetFromWindowsErrWithFilename` save now the error code before calling :c:func:`PyUnicode_DecodeFSDefault`.

Such C API functions as PyErr_SetString(), PyErr_Format(), PyErr_SetFromErrnoWithFilename() and many others no longer crash or ignore errors if it failed to format the error message or decode the filename. Instead, they keep a corresponding error.

Improve :exc:`DeprecationWarning` for uses of :c:type:`PyType_Spec` with metaclasses that have custom tp_new.

Implement the :c:macro:`Py_UNUSED` macro for Windows MSVC compiler. Patch by Victor Stinner.

:c:func:`PyModule_AddObjectRef` is now only available in the limited API version 3.10 or later.

Remove private _PyUnicode_AsString() alias to :c:func:`PyUnicode_AsUTF8`. It was kept for backward compatibility with Python 3.0 - 3.2. The :c:func:`PyUnicode_AsUTF8` is available since Python 3.3. The :c:func:`PyUnicode_AsUTF8String` function can be used to keep compatibility with Python 3.2 and older. Patch by Victor Stinner.

Convert :c:func:`PyObject_DelAttr` and :c:func:`PyObject_DelAttrString` macros to functions. Patch by Victor Stinner.

Add :c:func:`PyMapping_GetOptionalItem` function.

Add :c:func:`PyObject_GetOptionalAttr` and :c:func:`PyObject_GetOptionalAttrString` functions.

Remove _PyInterpreterState_Get() alias to :c:func:`PyInterpreterState_Get()` which was kept for backward compatibility with Python 3.8. Patch by Victor Stinner.

Remove cpython/pytime.h header file: it only contained private functions. Patch by Victor Stinner.

Remove private _PyObject_FastCall() function: use PyObject_Vectorcall() which is available since Python 3.8 (PEP 590). Patch by Victor Stinner.

If Python is built in :ref:`debug mode <debug-build>` or :option:`with assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:`PyList_SET_ITEM` now check the index argument with an assertion. If the assertion fails, make sure that the size is set before. Patch by Victor Stinner.

Remove the old aliases to functions calling functions which were kept for backward compatibility with Python 3.8 provisional API:

  • _PyObject_CallMethodNoArgs(): use PyObject_CallMethodNoArgs()
  • _PyObject_CallMethodOneArg(): use PyObject_CallMethodOneArg()
  • _PyObject_CallOneArg(): use PyObject_CallOneArg()
  • _PyObject_FastCallDict(): use PyObject_VectorcallDict()
  • _PyObject_Vectorcall(): use PyObject_Vectorcall()
  • _PyObject_VectorcallMethod(): use PyObject_VectorcallMethod()
  • _PyVectorcall_Function(): use PyVectorcall_Function()

Just remove the underscore prefix to update your code. Patch by Victor Stinner.

Adds :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` functions: similar to :c:func:`PyDict_GetItemWithError` but returning a :term:`strong reference` instead of a :term:`borrowed reference`. Patch by Victor Stinner.

Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT` functions: use the new :c:func:`PyWeakref_GetRef` function instead. Patch by Victor Stinner.

Add :c:func:`PyWeakref_GetRef` function: similar to :c:func:`PyWeakref_GetObject` but returns a :term:`strong reference`, or NULL if the referent is no longer live. Patch by Victor Stinner.

Add :c:func:`PyImport_AddModuleRef`: similar to :c:func:`PyImport_AddModule`, but return a :term:`strong reference` instead of a :term:`borrowed reference`. Patch by Victor Stinner.

The new :c:func:`PyType_GetDict` provides the dictionary for the given type object that is normally exposed by cls.__dict__. Normally it's sufficient to use :c:member:`~PyTypeObject.tp_dict`, but for the static builtin types :c:member:`!tp_dict` is now always NULL. :c:func:`!PyType_GetDict()` provides the correct dict object instead.

Fix a bug in :c:func:`PyErr_WarnExplicit` where an exception could end up being overwritten if the API failed internally.

We've renamed the new (in 3.12) PyInterpreterConfig.own_gil to PyInterpreterConfig.gil and changed the meaning of the value from "bool" to an integer with supported values of PyInterpreterConfig_DEFAULT_GIL, PyInterpreterConfig_SHARED_GIL, and PyInterpreterConfig_OWN_GIL. The default is "shared".

In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now implemented as opaque function calls to hide implementation details. Patch by Victor Stinner.

Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function which is just an alias to :c:func:`PyImport_ImportModule` since Python 3.3. Patch by Victor Stinner.

:c:func:`PyType_FromMetaclass` now allows metaclasses with tp_new set to NULL.

Remove the old private, undocumented and untested _PyGC_FINALIZED() macro which was kept for backward compatibility with Python 3.8 and older. Patch by Victor Stinner.

Remove PyEval_AcquireLock() and PyEval_ReleaseLock() functions, deprecated in Python 3.2. Patch by Victor Stinner.

Remove PyEval_InitThreads() and PyEval_ThreadsInitialized() functions, deprecated in Python 3.9. Patch by Victor Stinner.

Deprecate old Python initialization functions:

Patch by Victor Stinner.

PyObject_AsCharBuffer(), PyObject_AsReadBuffer(), PyObject_CheckReadBuffer(), and PyObject_AsWriteBuffer() are removed. Please migrate to new buffer protocol; :c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release`.

Deprecate the old Py_UNICODE and PY_UNICODE_TYPE types: use directly the :c:type:`wchar_t` type instead. Since Python 3.3, Py_UNICODE and PY_UNICODE_TYPE are just aliases to :c:type:`wchar_t`. Patch by Victor Stinner.

Remove the following old functions to configure the Python initialization, deprecated in Python 3.11:

  • PySys_AddWarnOptionUnicode()
  • PySys_AddWarnOption()
  • PySys_AddXOption()
  • PySys_HasWarnOptions()
  • PySys_SetArgvEx()
  • PySys_SetArgv()
  • PySys_SetPath()
  • Py_SetPath()
  • Py_SetProgramName()
  • Py_SetPythonHome()
  • Py_SetStandardStreamEncoding()
  • _Py_SetProgramFullPath()

Patch by Victor Stinner.

Remove functions deprecated in Python 3.9.

Patch by Victor Stinner.

PyTypeObject.tp_bases (and tp_mro) for builtin static types are now shared by all interpreters, whereas in 3.12-beta1 they were stored on PyInterpreterState. Also note that now the tuples are immortal objects.

Add PyUnstable_Exc_PrepReraiseStar to the unstable C api to expose the implementation of :keyword:`except* <except_star>`.

PY_SSIZE_T_CLEAN is no longer required to use '#' formats in APIs like :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue`. They uses Py_ssize_t for '#' regardless PY_SSIZE_T_CLEAN.

Add an unstable C API for hooking in an optimizer. This is mainly internal, but marked "unstable" to allow third-party experimentation.

Don't call :c:var:`PyOS_InputHook` or :c:var:`PyOS_ReadlineFunctionPointer` in subinterpreters, since it's generally difficult to avoid using global state in their registered callbacks. This also avoids situations where extensions may find themselves running in a subinterpreter they don't support (or haven't yet been loaded in).

Add :c:func:`PyModule_Add` function: similar to :c:func:`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals a reference to the value.

Properly handle trailing spaces before closing parenthesis in :c:func:`Py_BuildValue` format strings.