Changelog¶
Python next¶
Release date: XXXX-XX-XX
Windows¶
gh-146458: Fix incorrect REPL height and width tracking on console window resize on Windows.
Security¶
gh-148395: Fix a dangling input pointer in
lzma.LZMADecompressor,bz2.BZ2Decompressor, and internalzlib._ZlibDecompressorwhen memory allocation fails withMemoryError, which could let a subsequentdecompress()call read or write through a stale pointer to the already-released caller buffer.gh-148252: Fixed stack depth calculation in
_remote_debuggingwhen decoding certain.pybinputs on 32-bit builds. Issue originally identified and diagnosed by Tristan Madani (@TristanInSec on GitHub).gh-148178: Hardened
_remote_debuggingby validating remote debug offset tables before using them to size memory reads or interpret remote layouts.gh-148169: A bypass in
webbrowserallowed URLs prefixed with%actionto pass the dash-prefix safety check.gh-146333: Fix quadratic backtracking in
configparser.RawConfigParseroption parsing regexes (OPTCREandOPTCRE_NV). A crafted configuration line with many whitespace characters could cause excessive CPU usage.gh-146211: Reject CR/LF characters in tunnel request headers for the HTTPConnection.set_tunnel() method.
Library¶
gh-148688:
bz2,compression.zstd,lzma,zlib: Fix a double free on memory allocation failure. Patch by Victor Stinner.gh-148651: Fix reference leak in
compression.zstd.ZstdDecompressorwhen an invalid option key is passed.gh-148639: Implement PEP 800, adding the
@typing.disjoint_basedecorator. Patch by Jelle Zijlstra.gh-148508: An intermittent timing error when running SSL tests on iOS has been resolved.
gh-144881:
asynciodebugging tools (python -m asyncio psandpstree) now retry automatically on transient errors that can occur when attaching to a process under active thread delegation. The number of retries can be controlled with the--retriesflag. Patch by Bartosz Sławecki.gh-148464: Add missing
__ctype_le/be__attributes forc_float_complexandc_double_complex. Patch by Sergey B Kirpichev.gh-148370:
configparser: prevent quadratic behavior when aParsingErroris raised after a parser fails to parse multiple lines. Patch by Bénédikt Tran.gh-121190:
importlib.resources.files()now emits a more meaningful error message when module spec is None (as found in some__main__modules).gh-127012:
importlib.abc.Traversable.read_textnow allows/solicits anerrorsparameter.gh-137855: Improve import time of
dataclassesmodule by lazy importingreandcopymodules.gh-148254: Use singular “sec” instead of “secs” in
timeitverbose output for consistency with other time units.gh-148241:
json: Fix serialization: no longer callstr(obj)onstrsubclasses. Patch by Victor Stinner.gh-148225: The
profiling.samplingreplaycommand now rejects non-binary profile files with a clear error explaining that replay only accepts files created with--binary.gh-148192:
email.generator.Generator._make_boundarycould fail to detect a duplicate boundary string if linesep was not n. It now correctly detects boundary strings when linesep is rn as well.gh-148100: Soft deprecate
re.match()andre.Pattern.match()in favour ofre.prefixmatch()andre.Pattern.prefixmatch(). Patch by Hugo van Kemenade.gh-147957: Guarantees that
collections.UserDict.popitem()will pop in the same order as the wrapped dictionary rather than an arbitrary order.gh-146609: Add colour to
timeitCLI output. Patch by Hugo van Kemenade.gh-146563:
xml.parsers.expat: add an exception note when a custom Expat handler return value cannot be properly interpreted. Patch by Bénédikt Tran.gh-146313: Fix a deadlock in
multiprocessing’s resource tracker where the parent process could hang indefinitely inos.waitpid()during interpreter shutdown if a child created viaos.fork()still held the resource tracker’s pipe open.gh-146292: Add colour to
BaseHTTPRequestHandlerlogs, as used by thehttp.serverCLI. Patch by Hugo van Kemenade.gh-145846: Fix memory leak in
_lsprofwhenclear()is called during active profiling with nested calls.clearEntries()now walks the entirecurrentProfilerContextlinked list instead of only freeing the top context.gh-145831: Fix
email.quoprimime.decode()leaving a stray\rwheneol='\r\n'by stripping the full eol string instead of one character.gh-145244: Fixed a use-after-free in
jsonencoder when adefaultcallback mutates the dictionary being serialized.gh-117716: Fix
wavewriting of odd-sizeddatachunks by appending the required RIFF pad byte and correcting the RIFF chunk size field accordingly.gh-145200:
hashlib: fix a memory leak when allocating or initializing an OpenSSL HMAC context fails.gh-145105: Fix crash in
csvreader when iterating with a re-entrant iterator that callsnext()on the same reader from within__next__.gh-70647:
strptime()now raisesValueErrorwhen the format string contains%dwithout a year directive. Using%ewithout a year now emits aDeprecationWarning.gh-105936: Attempting to mutate non-field attributes of
dataclasseswith both frozen and slots beingTruenow raisesFrozenInstanceErrorinstead ofTypeError. Their non-dataclass subclasses can now freely mutate non-field attributes, and the original non-slotted class can be garbage collected.gh-142831: Fix a crash in the
jsonmodule where a use-after-free could occur if the object being encoded is modified during serialization.gh-130273: Fix traceback color output with Unicode characters.
gh-134551: Add t-strings support to pprint functions
gh-123853: Update the table of Windows language code identifiers (LCIDs) used by
locale.getdefaultlocale()on Windows to protocol version 16.0 (2024-04-23).gh-70039: Fixed bug where
smtplib.SMTP.starttls()could fail ifsmtplib.SMTP.connect()is called explicitly rather than implicitly.gh-96894: Do not turn echo off for subsequent commands in batch activators (
activate.batanddeactivate.bat) ofvenv.
IDLE¶
gh-94523: Detect file if modified at local disk and prompt to ask refresh. Patch by Shixian Li.
gh-139551: Support rendering
BaseExceptionGroupin IDLE.gh-89520: Make IDLE extension configuration look at user config files, allowing user-installed extensions to have settings and key bindings defined in ~/.idlerc.
Documentation¶
gh-146646: Document that
glob.glob(),glob.iglob(),pathlib.Path.glob(), andpathlib.Path.rglob()silently suppressOSErrorexceptions raised from scanning the filesystem.
Core and Builtins¶
gh-148653: Forbid
marshallingrecursive code objects,sliceandfrozendictobjects which cannot be correctly unmarshalled.gh-148515: Fix a bug in the JIT optimizer reading operands for uops with multiple caches.
gh-148390: Fix an undefined behavior in
memoryviewwhen using the native boolean format (?) incast(). Previously, on some common platforms, callingmemoryview(b).cast("?").tolist()incorrectly returned[False]instead of[True]for any even byte b. Patch by Bénédikt Tran.gh-148393: Fix data races between
PyDict_Watch()/PyDict_Unwatch()and concurrent dict mutation in the free-threaded build.gh-148398: Fix a bug in the JIT optimizer where class attribute loads were not invalidated after type mutation.
gh-148284: Fix high stack consumption in Python’s interpreter loop on Clang 22 by setting function limits for inlining when building with computed gotos.
gh-148037: Remove critical section from
PyCode_Addr2Line()in free-threading.gh-115802: Improve JIT code generation on Linux AArch64 by reducing the indirect call to external symbols. Patch by Diego Russo.
gh-148222: Fix vectorcall support in
types.GenericAliaswhen the underlying type does not support the vectorcall protocol. Fix possible leaks intypes.GenericAliasandtypes.UnionTypein case of memory error.gh-148208: Fix recursion depth leak in
PyObject_Print()gh-95004: The specializing interpreter now specializes for
enum.Enumimproving performance and scaling in free-threading. Patch by Kumar Aditya.gh-148014: Accept a function name in
-X presitecommand line option andPYTHON_PRESITEenvironment variable. Patch by Victor Stinner.gh-146306: Specialize float true division in the tier 2 optimizer with inplace mutation for uniquely-referenced operands.
gh-146031: The unstable API _PyInterpreterState_SetEvalFrameFunc has a companion function _PyInterpreterState_SetEvalFrameAllowSpecialization to specify if specialization should be allowed. When this option is set to 1 the specializer will turn Python -> Python calls into specialized opcodes which the replacement interpreter loop can choose to respect and perform inlined dispatch.
gh-145278: The
encodingsis now partially frozen, including thealiasesandutf_8submodules.The
linecacheis now frozen.gh-134584: Optimize and eliminate redundant ref-counting for
MAKE_FUNCTIONin the JIT.gh-143886: Reorder function annotations so positional-only arguments are returned before other arguments. This fixes how
functools.singledispatch()registers functions with positional-only arguments.gh-137814: Fix the
__qualname__attribute of__annotate__functions on functions.gh-100239: Specialize
BINARY_OPfor concatenation of lists and tuples, and propagate the result type through_BINARY_OP_EXTENDin the tier 2 optimizer so that follow-up type guards can be eliminated.
C API¶
gh-146636: Implement PEP 803 –
abi3t: Stable ABI for Free-Threaded Builds.gh-146302:
Py_IsInitialized()no longer returns true until initialization has fully completed, including import of thesitemodule. The underlying runtime flags now use atomic operations.gh-145921: Add functions that are guaranteed to be safe for use in
tp_traversehandlers:PyObject_GetTypeData_DuringGC(),PyObject_GetItemData_DuringGC(),PyType_GetModuleState_DuringGC(),PyModule_GetState_DuringGC(),PyModule_GetToken_DuringGC(),PyType_GetBaseByToken_DuringGC(),PyType_GetModule_DuringGC(),PyType_GetModuleByToken_DuringGC().
Build¶
gh-148535: No longer use the
gcc -fprofile-update=atomicflag on i686. The flag has been added to fix a random GCC internal error on PGO build (gh-145801) caused by corruption of profile data (.gcda files). The problem is that it makes the PGO build way slower (up to 47x slower) on i686. Since the GCC internal error was not seen on i686 so far, don’t use-fprofile-update=atomicon i686 anymore. Patch by Victor Stinner.gh-148483: Use
Py_GCC_ATTRIBUTE(unused)for stop_tracing label.gh-148474: Fixed compilation of
Python/pystrhex.cwith older clang versions.gh-146445: The Android build tools have been moved to the Platforms folder.
gh-146264: Fix static module builds on non-WASI targets by linking HACL dependencies as static libraries when
MODULE_BUILDTYPE=static, preventing duplicate_Py_LibHacl_*symbol errors at link time.gh-133312: Add a new
./configureoption--enable-static-libpython-for-interpreterwhich, when used with--enable-shared, continues to build the shared library but does not use it for the interpreter. Instead, libpython is statically linked into the interpreter, as if--enable-sharedhad not been used. This allows you to do a single build and get a Python interpreter binary that does not use a shared library but also get a shared library for use by other programs.
Python 3.15.0 alpha 8¶
Release date: 2026-04-07
Security¶
gh-145986:
xml.parsers.expat: Fixed a crash caused by unbounded C recursion when converting deeply nested XML content models withElementDeclHandler(). This addresses CVE 2026-4224.gh-145599: Reject control characters in
http.cookies.Morselupdate()andjs_output(). This addresses CVE 2026-3644.gh-143930: Reject leading dashes in URLs passed to
webbrowser.open().
Core and Builtins¶
gh-148157: Fix an unlikely crash when parsing an invalid type comments for function parameters. Found by OSS Fuzz in #492782951.
gh-100239: Propagate result type and uniqueness information through
_BINARY_OP_EXTENDin the tier 2 optimizer, enabling elimination of downstream type guards and selection of inplace float operations.gh-148144: Initialize
_PyInterpreterFrame.visitedwhen copying interpreter frames so incremental GC does not read an uninitialized byte from generator and frame-object copies.gh-148072: Cache
pickle.dumpsandpickle.loadsper interpreter in the XIData framework, avoiding repeated module lookups on every cross-interpreter data transfer. This speeds upInterpreterPoolExecutorfor mutable types (list,dict) by 1.7x–3.3x.gh-148110: Fix
sys.set_lazy_imports_filter()so relative lazy imports pass the resolved imported module name to the filter callback. Patch by Pablo Galindo.gh-148083: Constant-fold
_CONTAINS_OP_SETforfrozenset. Patch by Donghee Na.gh-144319: Fix a bug that could cause applications with specific allocation patterns to leak memory via Huge Pages if compiled with Huge Page support. Patch by Pablo Galindo
gh-147985: Make
PySet_Contains()attempt a lock-free lookup, similar toset.__contains__(). This avoids acquiring the set object mutex in the normal case.gh-147856: Allow the count argument of
bytes.replace()to be a keyword.gh-146615: Fix a crash in
__get__()for METH_METHOD descriptors when an invalid (non-type) object is passed as the second argument. Patch by Steven Sun.gh-146306: Optimize compact integer arithmetic in the JIT by mutating uniquely-referenced operands in place, avoiding allocation of a new int object. Speeds up the pyperformance
spectral_normbenchmark by ~10%.gh-146587: Fix type slot assignment incase of multiple slots for same name in type object implementation. Patch by Kumar Aditya.
gh-126910: Set frame pointers in
aarch64-unknown-linux-gnuJIT code, allowing most native profilers and debuggers to unwind through them. Patch by Diego Russogh-146388: Adds a null check to handle when the JIT optimizer runs out of space when dealing with contradictions in
make_bottom.gh-146369: Ensure
-X lazy_imports=none`andPYTHON_LAZY_IMPORTS=none`override__lazy_modules__. Patch by Hugo van Kemenade.gh-146308: Fixed multiple error handling issues in the
_remote_debuggingmodule including a double-free in code object caching, memory leaks on allocation failure, missing exception checks in binary format varint decoding, reference leaks on error paths in frame chain processing, and inconsistent thread status error reporting across platforms. Patch by Pablo Galindo.gh-146306: Optimize float arithmetic in the JIT by mutating uniquely-referenced operands in place, avoiding allocation of a new float object. Speeds up the pyperformance
nbodybenchmark by ~19%.gh-146128: Fix a bug which could cause constant values to be partially corrupted in AArch64 JIT code. This issue is theoretical, and hasn’t actually been observed in unmodified Python interpreters.
gh-146250: Fixed a memory leak in
SyntaxErrorwhen re-initializing it.gh-146245: Fixed reference leaks in
socketwhen audit hooks raise exceptions insocket.getaddrinfo()andsocket.sendto().gh-146151:
memoryviewnow supports the float complex and double complex C types: formatting characters'F'and'D'respectively. Patch by Sergey B Kirpichev.gh-146196: Fix potential Undefined Behavior in
PyUnicodeWriter_WriteASCII()by adding a zero-length check. Patch by Shamil Abdulaev.gh-146227: Fix wrong type in
_Py_atomic_load_uint16in the C11 atomics backend (pyatomic_std.h), which used a 32-bit atomic load instead of 16-bit. Found by Mohammed Zuhaib.gh-146205: Fixed a bug where
select.epoll.close(),select.kqueue.close(), andselect.devpoll.close()silently ignored errors.gh-146199: Comparison of code objects now handles errors correctly.
gh-145667: Remove the
GET_ITER_YIELD_FROMinstruction, modifyingSENDto pair withGET_ITERwhen compilingyield fromexpressions.gh-146192: Add Base32 support to
binasciiand improve the performance of the Base32 converters inbase64. Patch by James Seo.gh-135871: Improve multithreaded scaling of PyMutex in low-contention scenarios by reloading the lock’s internal state, without slowing down high-contention scenarios.
gh-146096: Fixed segmentation fault when called repr for BaseExceptionGroup with empty or 1-size tuple args.
gh-146056: Fix
repr()for lists and tuples containingNULLs.gh-145059: Fixed
sys.lazy_modulesto include lazy modules without submodules. Patch by Bartosz Sławecki.gh-146041: Fix free-threading scaling bottleneck in
sys.intern()andPyObject_SetAttr()by avoiding the interpreter-wide lock when the string is already interned and immortalized.gh-145990:
python --help-envsections are now sorted by environment variable name.gh-145990:
python --help-xoptionsis now sorted by-Xoption name.gh-145876:
AttributeErrors andKeyErrors raised inkeys()or__getitem__()during dictionary unpacking ({**mymapping}orfunc(**mymapping)) are no longer masked byTypeError.gh-127958: Support tracing from function entrypoints in the JIT. Patch by Ken Jin.
gh-145376: Fix GC tracking in
structseq.__replace__().gh-145792: Fix out-of-bounds access when invoking faulthandler on a CPython build compiled without support for VLAs.
gh-142183: Avoid a pathological case where repeated calls at a specific stack depth could be significantly slower.
gh-145779: Improve scaling of
classmethod()andstaticmethod()calls in the free-threaded build by avoiding the descriptor__get__call.gh-145783: Fix an unlikely crash in the parser when certain errors were erroneously not propagated. Found by OSS Fuzz in #491369109.
gh-145685: Improve scaling of type attribute lookups in the free-threaded build by avoiding contention on the internal type lock.
gh-145713: Make
bytearray.resize()thread-safe in the free-threaded build by using a critical section and calling the lock-held variant of the resize function.gh-145036: In free-threaded build, fix race condition when calling
__sizeof__()on alistgh-134584: Eliminate redundant refcounting for
MATCH_CLASSin the JIT.gh-69605: Add
math.integerto REPL auto-completion of imports.gh-131798: Optimize
_ITER_CHECK_RANGEand_ITER_CHECK_LISTin the JITgh-143414: Add tracking to the JIT optimizer to determine whether a reference is uniquely owned or shared
gh-143636: Fix a crash when calling
SimpleNamespace.__replace__()on non-namespace instances. Patch by Bénédikt Tran.gh-126910: Set frame pointers in
x86_64-unknown-linux-gnuJIT code, allowing most native profilers and debuggers to unwind through them.gh-140594: Fix an out of bounds read when a single NUL character is read from the standard input. Patch by Shamil Abdulaev.
gh-140870: Add support for module attributes in the REPL auto-completion of imports.
Library¶
gh-144503: Fix a regression introduced in 3.14.3 and 3.13.12 where the
multiprocessingforkserverstart method would fail withBrokenPipeErrorwhen the parent process had a very largesys.argv. The argv is now passed to the forkserver as separate command-line arguments rather than being embedded in the-ccommand string, avoiding the operating system’s per-argument length limit.gh-148153:
base64.b32encode()now always raisesValueErrorinstead ofAssertionErrorfor the value of map01 with invalid length.gh-73613: Add the padded parameter in functions related to Base32 and Base64 codecs in the
binasciiandbase64modules. In the encoding functions it controls whether the pad character can be added in the output, in the decoding functions it controls whether padding is required in input. Padding of input no longer required inbase64.urlsafe_b64decode()by default.gh-146613:
itertools: Fix a crash initertools.groupby()when the grouper iterator is concurrently mutated.gh-147944: Accepted range for the bytes_per_sep argument of
bytes.hex(),bytearray.hex(),memoryview.hex(), andbinascii.b2a_hex()is now increased, so passingsys.maxsizeand-sys.maxsizeis now valid.gh-146080:
ssl: fix a crash when an SNI callback tries to use an SSL object that has already been garbage-collected. Patch by Bénédikt Tran.gh-146556: Fix
annotationlib.get_annotations()hanging indefinitely when called witheval_str=Trueon a callable that has a circular__wrapped__chain (e.g.f.__wrapped__ = f). Cycle detection using an id-based visited set now stops the traversal and falls back to the globals found so far, mirroring the approach ofinspect.unwrap().gh-146090:
sqlite3: fix a crash whensqlite3.Connection.create_collation()fails with SQLITE_BUSY. Patch by Bénédikt Tran.gh-146090:
sqlite3: properly raiseMemoryErrorinstead ofSystemErrorwhen a context callback fails to be allocated. Patch by Bénédikt Tran.gh-146507: Make
asyncio.SelectorEventLoop()stream transport’sget_write_buffer_size()O(1) by maintaining a running byte counter instead of iterating the buffer on every call.gh-145056: Fix merging of
collections.OrderedDictandfrozendict.gh-145056: Add support for merging
collections.UserDictandfrozendict.gh-145633: Fix
struct.pack('f', float): usePyFloat_Pack4()to raiseOverflowError. Patch by Sergey B Kirpichev and Victor Stinner.gh-146440:
json: Add the array_hook parameter toload()andloads()functions: allow a callback for JSON literal array types to customize Python lists in the resulting decoded object. Passing combinedfrozendictto object_pairs_hook param andtupletoarray_hookwill yield a deeply nested immutable Python structure representing the JSON data.gh-146431: Add the wrapcol parameter to
base64functionsb16encode(),b32encode(),b32hexencode(),b85encode()andz85encode(), andbinasciifunctionsb2a_base32()andb2a_base85(). Add the ignorechars parameter tobase64functionsb16decode(),b32decode(),b32hexdecode(),b85decode()andz85decode(), andbinasciifunctionsa2b_hex(),unhexlify(),a2b_base32()anda2b_base85().gh-146310: The
ensurepipmodule no longer looks forpip-*.whlwheel packages in the current directory.gh-141510: Support
frozendictinplistlib, for serialization only. Patch by Hugo van Kemenade.gh-146238: Support half-floats (type code
'e'of thestructmodule) in thearraymodule. Patch by Sergey B Kirpichev.gh-140947: Fix incorrect contextvars handling in server tasks created by
asyncio. Patch by Kumar Aditya.gh-146151: Support the float complex and double complex C types in the
arraymodule: formatting characters'F'and'D'respectively. Patch by Sergey B Kirpichev.gh-143387: In importlib.metadata, when a distribution file is corrupt and there is no metadata file, calls to
Distribution.metadata()(including implicit calls from other properties like.nameand.requires) will now raise aMetadataNotFoundException. This allows callers to distinguish between missing metadata and a degenerate (empty) metadata. Previously, if the file was missing, an emptyPackageMetadatawould be returned and would be indistinguishable from the presence of an empty file.gh-146228: Cached FastPath objects in importlib.metadata are now cleared on fork, avoiding broken references to zip files during fork.
gh-146171: Nested
AttributeErrorsuggestions now include property-backed attributes on nested objects without executing the property getter.gh-145410: On Windows,
sysconfig.get_platform()now gets the platform from the_sysconfigmodule instead of parsingsys.versionstring. Patch by Victor Stinner.gh-146091: Fix a bug in
termios.tcsetwinsize()where passing a sequence that raises an exception in__getitem__would cause aSystemErrorinstead of propagating the original exception.gh-146076:
zoneinfo: fix crashes when deleting_weak_cachefrom azoneinfo.ZoneInfosubclass.gh-123471: Make concurrent iteration over
itertools.zip_longestsafe under free-threading.gh-146075: Errors when calling
functools.partial()with a malformed keyword will no longer crash the interpreter.gh-146054: Limit the size of
encodings.search_function()cache. Found by OSS Fuzz in #493449985.gh-146004: All
-Xoptions from the Python command line are now propagated to child processes spawned bymultiprocessing, not just a hard-coded subset. This makes the behavior consistent between default “spawn” and “forkserver” start methods and the old “fork” start method. The options that were previously not propagated are:context_aware_warnings,cpu_count,disable-remote-debug,int_max_str_digits,lazy_imports,no_debug_ranges,pathconfig_warnings,perf,perf_jit,presite,pycache_prefix,thread_inherit_context, andwarn_default_encoding.gh-145980: Added the alphabet parameter in
b2a_base64(),a2b_base64(),b2a_base85()anda2b_base85()and a number of*_ALPHABETconstants in thebinasciimodule. Removedb2a_z85()anda2b_z85().gh-145968: Fix translation in
base64.b64decode()when altchars overlaps with the standard ones.gh-145966: Non-
AttributeErrorexceptions raised during dialect attribute lookup incsvare no longer silently suppressed.gh-145883:
zoneinfo: Fix heap buffer overflow reads from malformed TZif data. Found by OSS Fuzz, issues #492245058 and #492230068.gh-145850: Changed some implementation details in
struct.Struct: calling it with non-ASCII string format will now raise aValueErrorinstead ofUnicodeEncodeError, calling it with non-ASCII bytes format will now raise aValueErrorinstead ofstruct.error, getting theformatattribute of uninitialized object will now raise anAttributeErrorinstead ofRuntimeError.gh-123720: asyncio: Fix
asyncio.Server.serve_forever()shutdown regression. Since 3.12, cancellingserve_forever()could hang waiting for a handler blocked on a read from a client that never closed (effectively requiring two interrupts to stop); the shutdown sequence now ensures client streams are closed soserve_forever()exits promptly and handlers observe EOF.gh-138122: The
profiling.samplingmodule now supports differential flamegraph visualization via--diff-flamegraphto compare two profiling runs. Functions are colored red (regressions), blue (improvements), gray (neutral), or purple (new). Elided stacks show code paths that disappeared between runs.gh-145754: Request signature during mock autospec with
FORWARDREFannotation format. This prevents runtime errors when an annotation uses a name that is not defined at runtime.gh-145750: Avoid undefined behaviour from signed integer overflow when parsing format strings in the
structmodule. Found by OSS Fuzz in #488466741.gh-145717: Add a few Microsoft-specific MIME types.
gh-145703:
asyncio: Make sure thatloop.call_atandloop.call_latertrigger scheduled events on time when the clock resolution becomes too small.gh-145697: Add
application/sqlandapplication/vnd.sqlite3intomimetypes.gh-145492: Fix infinite recursion in
collections.defaultdict__repr__when adefaultdictcontains itself. Based on analysis by KowalskiThomas in gh-145492.gh-145650: Add
__repr__()support tologging.Formatterandlogging.Filter, showing the format string and filter name respectively.gh-145587: Resolved a performance regression in
multiprocessing.connection.waiton Windows that caused infinite busy loops when called with no objects. The function now properly yields control to the OS to conserve CPU resources. Patch By Shrey Naithanigh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel
gh-145546: Fix
unittest.util.sorted_list_difference()to deduplicate remaining elements when one input list is exhausted before the other.gh-145446: Now
functoolsis safer in free-threaded build when using keywords infunctools.partial()gh-145264: Base64 decoder (see
binascii.a2b_base64(),base64.b64decode(), etc) no longer ignores excess data after the first padded quad in non-strict (default) mode. Instead, in conformance with RFC 4648, section 3.3, it now ignores the pad character, “=”, if it is present before the end of the encoded data.gh-145035: Allows omitting the internal library
_pyreplwith limited loss of functionality. This allows complete removal of the modern REPL, which is an unsupported configuration, but still desirable for some distributions.gh-144270: Made the tag parameter of
xml.etree.ElementTree.Elementand the parent and tag parameters ofxml.etree.ElementTree.SubElement()positional-only, matching the behavior of the C accelerator.gh-144984: Fix crash in
xml.parsers.expat.xmlparser.ExternalEntityParserCreate()when an allocation fails. The error paths could dereference NULLhandlersand double-decrement the parent parser’s reference count.gh-144975:
wave.Wave_write.setframerate()now validates the frame rate after rounding to an integer, preventing values like0.5from being accepted and causing confusing errors later. Patch by Michiel Beijen.gh-140715: Add
%nand%tsupport tostrptime().gh-144259: Fix inconsistent display of long multiline pasted content in the REPL.
gh-140814:
multiprocessing.freeze_support()no longer sets the default start method as a side effect, which previously caused a subsequentmultiprocessing.set_start_method()call to raiseRuntimeError.gh-123471: Make concurrent iteration over
itertools.accumulatesafe under free-threading.gh-143715: Calling the
Struct.__new__()without required argument now is deprecated. Calling__init__()method on initializedStructobjects is deprecated.gh-142763: Fix a race condition between
zoneinfo.ZoneInfocreation andzoneinfo.ZoneInfo.clear_cache()that could raiseKeyError.gh-141707: Don’t change
tarfile.TarInfotype fromAREGTYPEtoDIRTYPEwhen parsing GNU long name or link headers.gh-138577:
getpass.getpass()with non-emptyecho_charnow handles keyboard shortcuts including Ctrl+A/E (cursor movement), Ctrl+K/U (kill line), Ctrl+W (erase word), and Ctrl+V (literal next) by reading the terminal’s control character settings and processing them appropriately in non-canonical mode. Patch by Sanyam Khurana.gh-140049:
traceback.format_exception_only()now colorizes exception notes.gh-139933: Improve
AttributeErrorsuggestions for classes with a custom__dir__()method returning a list of unsortable values. Patch by Bénédikt Tran.gh-139633: The
netrcsecurity check is now run once per parse rather than once per entry.gh-130472: Add fancycompleter and enable it by default when using pyrepl. This gives colored tab completion.
gh-112632: Add an expand keyword argument for
pprint.pprint(),pprint.pformat(),pprint.pp()by passing on all kwargs andpprint.PrettyPrinter. Contributed by Stefan Todoran and Semyon Moroz.gh-66419: Optional argument with nargs equals to
argparse.REMAINDERnow consumes all remaining arguments including'--'.gh-60729: Add support for floating point audio wave files in
wave.bpo-36461: Make the target time of
timeit.Timer.autorange()configurable and add--target-timeoption to the command-line interface oftimeit.
Documentation¶
Tests¶
gh-144418: The Android testbed’s emulator RAM has been increased from 2 GB to 4 GB.
gh-146202: Fix a race condition in regrtest: make sure that the temporary directory is created in the worker process. Previously, temp_cwd() could fail on Windows if the “build” directory was not created. Patch by Victor Stinner.
Build¶
gh-146541: The Android testbed can now be built for 32-bit ARM and x86 targets.
gh-146498: The iOS XCframework build script now ensures libpython isn’t included in installed app content, and is more robust in identifying standard library binary content that requires processing.
gh-146450: The Android build script was modified to improve parity with other platform build scripts.
gh-146446: The clean target for the Apple/iOS XCframework build script is now more selective when targeting a single architecture.
gh-146444: The Apple/iOS build script has been moved to the Platforms directory.
gh-146210: Fix building the jit stencils on Windows when the interpreter is built with a different clang version. Patch by Chris Eibl.
gh-145844: Update to WASI SDK 32.
gh-145801: When Python build is optimized with GCC using PGO, use
-fprofile-update=atomicoption to use atomic operations when updating profile information. This option reduces the risk of gcov Data Files (.gcda) corruption which can cause random GCC crashes. Patch by Victor Stinner.gh-138850: Add
--disable-epolltoconfiguregh-145633: Remove support for ancient ARM platforms (ARMv4L and ARMv5L OABI boards), using mixed-endian representation for doubles. Patch by Sergey B Kirpichev.
gh-85277: Fix building without
stropts.hor emptystropts.h
Windows¶
gh-140131: Fix REPL cursor position on Windows when module completion suggestion line hits console width.
macOS¶
gh-137586: Invoke osascript with absolute path in
webbrowserandturtledemo.
Tools/Demos¶
gh-135953: Properly identify the main thread in the Gecko profiler collector by using a status flag from the interpreter state instead of relying on
threading.main_thread()in the collector process.gh-145976: Remove
Misc/indent.pro, a configuration file for GNU indent(1).gh-145976: Remove
Misc/vgrindefsandMisc/Porting.
C API¶
gh-146636: The
Py_mod_abislot is now mandatory for modules created from a slots array (usingPyModule_FromSlotsAndSpec()or thePyModExport_*export hook).gh-146175: The following macros are soft deprecated:
Py_ALIGNED,PY_FORMAT_SIZE_T,Py_LL,Py_ULL,PY_LONG_LONG,PY_LLONG_MIN,PY_LLONG_MAX,PY_ULLONG_MAX,PY_INT32_T,PY_UINT32_T,PY_INT64_T,PY_UINT64_T,PY_SIZE_MAX,Py_UNICODE_SIZE,Py_VA_COPY.The macro
Py_UNICODE_WIDE, which was scheduled for removal, is soft deprecated instead.gh-146143:
PyUnicodeWriter_WriteUCS4()now accepts a pointer to a constant buffer ofPy_UCS4.gh-146056:
PyUnicodeWriter_WriteRepr()now supportsNULLargument.gh-145010: Use GCC dialect alternatives for inline assembly in
object.hso that the Python headers compile correctly with-masm=intel.
Python 3.15.0 alpha 7¶
Release date: 2026-03-10
Windows¶
gh-145731: Fix negative timestamp during DST on Windows. Patch by Hugo van Kemenade.
gh-145307: Defers loading of the
psapi.dllmodule until it is used byctypes.util.dllist().gh-144551: Updated bundled version of OpenSSL to 3.5.5.
Tests¶
gh-144741: Fix
test_frame_pointer_unwindwhen Python is built with--enable-shared. Classify also libpython frames as"python". Patch by Victor Stinner.gh-144739: When Python was compiled with system expat older then 2.7.2 but tests run with newer expat, still skip
test.test_pyexpat.MemoryProtectionTest.
Security¶
gh-145506: Fixes CVE 2026-2297 by ensuring that
SourcelessFileLoaderusesio.open_code()when opening.pycfiles.gh-144370: Disallow usage of control characters in status in
wsgiref.handlersto prevent HTTP header injections. Patch by Benedikt Johannes.
Library¶
gh-145623: Fix crash in
structwhen callingrepr()or__sizeof__()on an uninitializedstruct.Structobject created viaStruct.__new__()without calling__init__().gh-145551: Fix InvalidStateError when cancelling process created by
asyncio.create_subprocess_exec()orasyncio.create_subprocess_shell(). Patch by Daan De Meyer.gh-141510:
marshalnow supportsfrozendictobjects. The marshal format version was increased to 6. Patch by Victor Stinner.gh-145417:
venv: Prevent incorrect preservation of SELinux context when copying theActivate.ps1script. The script inherited the SELinux security context of the system template directory, rather than the destination project directory.gh-145335:
os.listdir(-1)andos.scandir(-1)now fail withOSError(errno.EBADF)rather than listing the current directory.os.listxattr(-1)now fails withOSError(errno.EBADF)rather than listing extended attributes of the current directory. Patch by Victor Stinner.gh-145376: Fix double free and null pointer dereference in unusual error scenarios in
hashlibandhmacmodules.gh-145301:
hmac: fix a crash when the initialization of the underlying C extension module fails.gh-145301:
hashlib: fix a crash when the initialization of the underlying C extension module fails.gh-76007: The
versionattribute of thetarfilemodule is deprecated and slated for removal in Python 3.20.gh-145158: Avoid undefined behaviour from signed integer overflow when parsing format strings in the
structmodule.gh-123853: Removed Windows 95 compatibility for
locale.getdefaultlocale().gh-66802: Add
unicodedata.block()function to return the Unicode block of a character.gh-145033: Add
typing.TypeForm, implementing PEP 747. Patch by Jelle Zijlstra.gh-141510:
dataclasses.field(): if metadata isNone, use an emptyfrozendict, instead of aMappingProxyType()of an emptydict. Patch by Victor Stinner.gh-145006: Add
ModuleNotFoundErrorhints when a module for a different ABI exists.gh-141510:
ParameterizedMIMEHeader.paramsofemail.headerregistryis now afrozendictinstead of atypes.MappingProxyType. Patch by Victor Stinner.gh-134872: Add valid import name suggestions on
ModuleNotFoundError.gh-88091: Fix
unicodedata.decomposition()for Hangul characters.gh-144986: Fix a memory leak in
atexit.register(). Patch by Shamil Abdulaev.gh-144777: Fix data races in
io.IncrementalNewlineDecoderin the free-threaded build.gh-144809: Make
collections.dequecopy atomic in the free-threaded build.gh-141510: The
copymodule now supports thefrozendicttype. Patch by Pieter Eendebak based on work by Victor Stinner.gh-141510: The
jsonmodule now supports thefrozendicttype. Patch by Victor Stinner.gh-144835: Added missing explanations for some parameters in
glob.glob()andglob.iglob().gh-144833: Fixed a use-after-free in
sslwhenSSL_new()returns NULL innewPySSLSocket(). The error was reported via a dangling pointer after the object had already been freed.gh-140715: Add
'%D'support tostrptime().gh-144782: Fix
argparse.ArgumentParserto bepickleable.gh-144763: Fix a race condition in
tracemalloc: it no longer detaches the attached thread state to acquire its internal lock. Patch by Victor Stinner.gh-142224:
unicodedata.bidirectional()now return the correct default bidi class for unassigned code points.gh-117865: Reduce the import time of
inspectmodule by ~20%.gh-144156: Fix the folding of headers by the
emaillibrary when RFC 2047 encoded words are used. Now whitespace is correctly preserved and also correctly added between adjacent encoded words. The latter property was broken by the fix for gh-92081, which mostly fixed previous failures to preserve whitespace.gh-66305: Fixed a hang on Windows in the
tempfilemodule when trying to create a temporary file or subdirectory in a non-writable directory.gh-144615: Methods directly decorated with
@functools.singledispatchmethodnow dispatch on the second argument when called after being accessed as class attributes. Patch by Bartosz Sławecki.gh-144321: The functional syntax for creating
typing.NamedTupleclasses now supports passing any iterable of fields and types. Previously, only sequences were supported.gh-144475: Calling
repr()onfunctools.partial()is now safer when the partial object’s internal attributes are replaced while the string representation is being generated.gh-144285: Attribute suggestions in
AttributeErrortracebacks are now formatted differently to make them easier to understand, for example:Did you mean '.datetime.now' instead of '.now'. Contributed by Bartosz Sławecki.gh-144316: Fix crash in
_remote_debuggingthat causedtest_external_inspectionto intermittently fail. Patch by Taegyun Kim.gh-143637: Fixed a crash in socket.sendmsg() that could occur if ancillary data is mutated re-entrantly during argument parsing.
gh-140652: Fix a crash in
_interpchannels.list_all()after closing a channel.gh-143698: Allow scheduler and setpgroup arguments to be explicitly
Nonewhen callingos.posix_spawn()oros.posix_spawnp(). Patch by Bénédikt Tran.gh-143698: Raise
TypeErrorinstead ofSystemErrorwhen the scheduler inos.posix_spawn()oros.posix_spawnp()is not a tuple. Patch by Bénédikt Tran.gh-142516:
ssl: fix reference leaks inssl.SSLContextobjects. Patch by Bénédikt Tran.gh-85809: Added path-like object support for
shutil.make_archive().gh-143304: Fix
ctypes.CDLLto honor thehandleparameter on POSIX systems.gh-142781:
zoneinfo: fix a crash when instantiatingZoneInfoobjects for which the internal class-level cache is inconsistent.gh-142787: Fix assertion failure in
sqlite3blob subscript when slicing with indices that result in an empty slice.gh-142352: Fix
asyncio.StreamWriter.start_tls()to transfer buffered data fromStreamReaderto the SSL layer, preventing data loss when upgrading a connection to TLS mid-stream (e.g., when implementing PROXY protocol support).gh-139899: Introduced
importlib.abc.MetaPathFinder.discover()andimportlib.abc.PathEntryFinder.discover()to allow module and submodule name discovery without assuming the use of traditional filesystem based imports.gh-137335: Get rid of any possibility of a name conflict for named pipes in
multiprocessingandasyncioon Windows, no matter how small.gh-135883: Fix
sqlite3’s interactive shell keeping part of previous commands when scrolling history.gh-124748: Improve
TypeErrorerror message whenweakref.WeakKeyDictionary.update()is used with keyword-only parameters.gh-80667: Add support for Tangut Ideographs names in
unicodedata.bpo-42353: The
remodule gains a newre.prefixmatch()function as an explicit spelling of what has to date always been known asre.match().re.Patternsimilary gains are.Pattern.prefixmatch()method.Why? Explicit is better than implicit. Other widely used languages all use the term “match” to mean what Python uses the term “search” for. The unadorened “match” name in Python has been a frequent case of confusion and coding bugs due to the inconsistency with the rest if the software industry.
We do not plan to deprecate and remove the older
matchname.bpo-40243: Fix
unicodedata.ucd_3_2_0.numeric()for non-decimal values.bpo-40212: Re-enable
os.posix_fallocate()andos.posix_fadvise()on AIX.bpo-3405: Add support for user data of Tk virtual events and detail for
Enter,Leave,FocusIn,FocusOut, andConfigureRequestevents totkinter.bpo-32234:
mailbox.Mailboxinstances can now be used as a context manager. The Mailbox is locked on context entry and unlocked and closed at context exit.
Documentation¶
gh-145450: Document missing public
wave.Wave_writegetter methods.gh-110937: Document rest of full public
importlib.metadata.DistributionAPI. Also add the (already documented)PackagePathto__all__.gh-136246: A new “Improve this page” link is available in the left-hand sidebar of the docs, offering links to create GitHub issues, discussion forum posts, or pull requests.
Core and Builtins¶
gh-145701: Fix
SystemErrorwhen__classdict__or__conditional_annotations__is in a class-scope inlined comprehension. Found by OSS Fuzz in #491105000.gh-145615: Fixed a memory leak in the free-threaded build where mimalloc pages could become permanently unreclaimable until the owning thread exited.
gh-116738: Make
mmap.mmap.set_name()thread-safe on the free threaded build.gh-145566: In the free threading build, skip the stop-the-world pause when reassigning
__class__on a newly created object.gh-143055: Fix crash in AST unparser when unparsing dict comprehension unpacking. Found by OSS Fuzz in #489790200.
gh-145335: Fix a crash in
os.pathconf()when called with-1as the path argument.gh-145376: Fix reference leaks in various unusual error scenarios.
gh-145234: Fixed a
SystemErrorin the parser when an encoding cookie (for example, UTF-7) decodes to carriage returns (\r). Newlines are now normalized after decoding in the string tokenizer.Patch by Pablo Galindo.
gh-145275: Added the
-X pathconfig_warningsandPYTHON_PATHCONFIG_WARNINGSoptions, allowing to disable warnings from The initialization of the sys.path module search path.gh-145273: A warning is now shown during The initialization of the sys.path module search path if it can’t find a valid standard library.
gh-145241: Specialized the parser error for when
withitems are followed by a trailing comma (for example,with item,:), raising a clearerSyntaxErrormessage. Patch by Pablo Galindo and Bartosz Sławecki.gh-130555: Fix use-after-free in
dict.clear()when the dictionary values are embedded in an object and a destructor causes re-entrant mutation of the dictionary.gh-145197: Fix JIT trace crash when recording function from cleared generator frame.
gh-145187: Fix compiler assertion fail when a type parameter bound contains an invalid expression in a conditional block.
gh-145142: Fix a crash in the free-threaded build when the dictionary argument to
str.maketrans()is concurrently modified.gh-145118:
str.maketrans()now acceptsfrozendict.gh-144015: Speed up
bytes.hex(),bytearray.hex(),binascii.hexlify(), andhashlib.hexdigest()operations with SIMD on x86-64, ARM64, and ARM32 with NEON when built with gcc (version 12 or higher) or clang (version 3 or higher) compilers. Around 1.1-3x faster for common 16-64 byte inputs such as hashlib hex digests, and up to 8x faster for larger data.gh-145118:
type()now acceptsfrozendictas an argument.gh-145064: Fix JIT optimizer assertion failure during
CALL_ALLOC_AND_ENTER_INITside exit.gh-145055:
exec()andeval()now acceptfrozendictfor globals. Patch by Victor Stinner.gh-145058: Fix a crash when
__lazy_import__()is passed a non-string argument, by raising anTypeErrorinstead.gh-144995: Optimize
memoryviewcomparison: amemoryviewis equal to itself, there is no need to compare values. Patch by Victor Stinner.gh-141510: Update specializer to support frozendict. Patch by Donghee Na.
gh-141510: Optimize
frozendict.fromkeys()to avoid unnecessary thread-safety operations in frozendict cases. Patch by Donghee Na.gh-100239: Speedup
BINARY_OP_EXTENDfor exact floats and medium-size integers by up to 15%. Patch by Chris Eibl.gh-144914: Use
mimallocfor raw memory allocations such as viaPyMem_RawMalloc()for better performance on free-threaded builds. Patch by Kumar Aditya.gh-144872: Fix heap buffer overflow in the parser found by OSS-Fuzz.
gh-144766: Fix a crash in fork child process when perf support is enabled.
gh-144759: Fix undefined behavior in the lexer when
startandmulti_line_startpointers areNULLin_PyLexer_remember_fstring_buffers()and_PyLexer_restore_fstring_buffers(). TheNULLpointer arithmetic (NULL - valid_pointer) is now guarded with explicitNULLchecks.gh-141510: Add built-in
frozendicttype. Patch by Victor Stinner.gh-144681: Fix a JIT assertion failure when a conditional branch jumps to the same target as the fallthrough path.
gh-143300: Add
PyUnstable_SetImmortal()C-API function to mark objects as immortal.gh-144702: Clarify the error message raised when a class pattern is used to match on a non-class object.
gh-144569: Optimize
BINARY_SLICEfor list, tuple, and unicode by avoiding temporarysliceobject creation.gh-144438: Align the QSBR thread state array to a 64-byte cache line boundary to avoid false sharing in the free-threaded build.
gh-142349: Implement PEP 810. Patch by Pablo Galindo and Dino Viehland.
gh-141226: Deprecate PEP 456 support for providing an external definition of the string hashing scheme. Removal is scheduled for Python 3.19. Patch by Bénédikt Tran.
gh-138912: Improve
MATCH_CLASSperformance by up to 52% in certain cases. Patch by Marc Mueller.gh-130327: Fix erroneous clearing of an object’s
__dict__if overwritten at runtime.gh-80667: Literals using the
\N{name}escape syntax can now construct CJK ideographs and Hangul syllables using case-insensitive names.
C API¶
gh-142417: Restore private provisional
_Py_InitializeMain()function removed in Python 3.14. Patch by Victor Stinner.gh-144748:
PyErr_CheckSignals()now raises the exception scheduled byPyThreadState_SetAsyncExc(), if any.gh-144981: Made
PyUnstable_Code_SetExtra(),PyUnstable_Code_GetExtra(), andPyUnstable_Eval_RequestCodeExtraIndex()thread-safe on the free threaded build.gh-141510: Add the following functions for the new
frozendicttype:Patch by Victor Stinner.
gh-121617:
Python.hnow also includes<string.h>in the limited C API version 3.11 and newer to fix thePy_CLEARmacro which usesmemcpy(). Patch by Victor Stinner.gh-144175: Add
PyArg_ParseArray()andPyArg_ParseArrayAndKeywords()functions to parse arguments of functions using theMETH_FASTCALLcalling convention. Patch by Victor Stinner.
Build¶
gh-144533: Use wasmtime’s
--argv0to auto-discover sysconfig in WASI buildsgh-145110: Fix targets “Clean” and “CLeanAll” in case of PGO builds on Windows. Patch by Chris Eibl.
gh-144679: When building with Visual Studio 2026 (Version 18), use PlatformToolSet v145 by default. Patch by Chris Eibl.
gh-144675: Update to WASI SDK 30.
gh-136677: Introduce executable specific linker flags to
./configure.
Python 3.15.0 alpha 6¶
Release date: 2026-02-11
macOS¶
Windows¶
gh-80620: Support negative timestamps in
time.gmtime(),time.localtime(), and variousdatetimefunctions.
Tests¶
gh-144415: The Android testbed now distinguishes between stdout/stderr messages which were triggered by a newline, and those triggered by a manual call to
flush. This fixes logging of progress indicators and similar content.gh-65784: Add support for parametrized resource
wantobjectsin regrtests, which allows to run Tkinter tests with the specified value oftkinter.wantobjects, for example-u wantobjects=0.
Security¶
gh-144125:
BytesGeneratorwill now refuse to serialize (write) headers that are unsafely folded or delimited; seeverify_generated_headers. (Contributed by Bas Bloemsaat and Petr Viktorin in gh-121650).gh-143935: Fixed a bug in the folding of comments when flattening an email message using a modern email policy. Comments consisting of a very long sequence of non-foldable characters could trigger a forced line wrap that omitted the required leading space on the continuation line, causing the remainder of the comment to be interpreted as a new header field. This enabled header injection with carefully crafted inputs.
gh-143925: Reject control characters in
data:URL media types.gh-143923: Reject control characters in POP3 commands.
gh-143921: Reject control characters in IMAP commands.
gh-143919: Reject control characters in
http.cookies.Morselfields and values.gh-143916: Reject C0 control characters within wsgiref.headers.Headers fields, values, and parameters.
Library¶
gh-144538: Bump the version of pip bundled in ensurepip to version 26.0.1
gh-144493: Improve an exception error message in
_overlapped.BindLocal()that is raised whenasyncio.loop.sock_connect()is called on aasyncio.ProactorEventLoopwith a socket that has an invalid address family.gh-144386: Add support for arbitrary descriptors
__enter__(),__exit__(),__aenter__(), and__aexit__()incontextlib.ExitStackandcontextlib.AsyncExitStack, for consistency with thewithandasync withstatements.gh-123471: Make concurrent iteration over
itertools.combinations_with_replacementanditertools.permutationssafe under free-threading.gh-74453: Deprecate
os.path.commonprefix()in favor ofos.path.commonpath()for path segment prefixes.The
os.path.commonprefix()function is being deprecated due to having a misleading name and module. The function is not safe to use for path prefixes despite being included in a module about path manipulation, meaning it is easy to accidentally introduce path traversal vulnerabilities into Python programs by using this function.gh-144380: Improve performance of
io.BufferedReaderline iteration by ~49%.gh-140824: When
faulthandlerdumps the list of third-party extension modules, ignore sub-modules of stdlib packages. Patch by Victor Stinner.gh-144206: Improve error messages for buffer overflow in
fcntl.fcntl()andfcntl.ioctl().gh-144264: Speed up Base64 decoding of data containing ignored characters (both in non-strict mode and with an explicit ignorechars argument). It is now up to 2 times faster for multiline Base64 data.
gh-144249: Add filename context to
OSErrorexceptions raised byssl.SSLContext.load_cert_chain(), allowing users to have more context.gh-132888: Fix incorrect use of
ctypes.GetLastError()and add missing error checks for Windows API calls in_pyrepl.windows_console.gh-144217:
mimetypes: Add support for DICOM files (for medical imaging) with the official MIME typeapplication/dicom. Patch by Benedikt Johannes.gh-144212: Mime type
image/jxlis now supported bymimetypes.gh-143594: Add
symtable.Function.get_cells()andsymtable.Symbol.is_cell()methods.gh-144169: Fix three crashes when non-string keyword arguments are supplied to objects in the
astmodule.gh-144128: Fix a crash in
array.array.fromlist()when an element’s__index__()method mutates the input list during conversion.gh-144100: Fixed a crash in ctypes when using a deprecated
POINTER(str)type inargtypes. Instead of aborting, ctypes now raises a proper Python exception when the pointer target type is unresolved.gh-143658:
importlib.metadata: Usestr.lower()andstr.replace()to further improve performance ofimportlib.metadata.Prepared.normalize(). Patch by Hugo van Kemenade and Henry Schreiner.gh-144050: Fix
stat.filemode()in the pure-Python implementation to avoid misclassifying invalid mode values as block devices.gh-83069:
subprocess.Popen.wait(): whentimeoutis notNone, an efficient event-driven mechanism now waits for process termination, if available. Linux >= 5.3 usesos.pidfd_open()+select.poll(). macOS and other BSD variants useselect.kqueue()+KQ_FILTER_PROC+KQ_NOTE_EXIT. Windows keeps usingWaitForSingleObject(unchanged). If none of these mechanisms are available, the function falls back to the traditional busy loop (non-blocking call and short sleeps). Patch by Giampaolo Rodola.gh-144030: The Python implementation of
functools.lru_cache()differed from the default C implementation in that it did not check that its argument is callable. This discrepancy is now fixed and both raise aTypeError.gh-144001: Added the ignorechars parameter in
binascii.a2b_base64()andbase64.b64decode().gh-144023: Fixed validation of file descriptor 0 in posix functions when used with follow_symlinks parameter.
gh-143999: Fix an issue where
inspect.getgeneratorstate()andinspect.getcoroutinestate()could fail for generators wrapped bytypes.coroutine()in the suspended state.gh-143952: Fixed
asynciodebugging tools to work with new remote debugging API. Patch by Bartosz Sławecki.gh-143904:
struct.pack_into()now raises OverflowError instead of IndexError for too large offset argument.gh-143897: Remove the
isxidstart()andisxidcontinue()methods ofunicodedata.ucd_3_2_0. They are now only exposed asunicodedata.isxidstart()andunicodedata.isxidcontinue().gh-143831:
annotationlib.ForwardRefobjects are now hashable when created from annotation scopes with closures. Previously, hashing such objects would throw an exception. Patch by Bartosz Sławecki.gh-143874: Fixed a bug in
pdbwhere expression results were not sent back to remote client.gh-143754: Add new
tkinterwidget methodspack_content(),place_content()andgrid_content()which are alternative spelling of old*_slaves()methods.gh-143756: Fix potential thread safety issues in
sslmodule.gh-132604: Previously,
Protocolclasses that were not decorated with@~typing.runtime_checkable, but that inherited from anotherProtocolclass that did have this decorator, could be used inisinstance()andissubclass()checks. This behavior is now deprecated and such checks will throw aTypeErrorin Python 3.20. Patch by Bartosz Sławecki.gh-143543: Fix a crash in itertools.groupby that could occur when a user-defined
__eq__()method re-enters the iterator during key comparison.gh-143689: Fix
io.BufferedReader.read1()state cleanup on buffer allocation failure.gh-143602: Fix a inconsistency issue in
write()that leads to unexpected buffer overwrite by deduplicating the buffer exports.gh-142434: Use
ppoll()if available inselect.poll()to have a timeout resolution of 1 nanosecond, instead of a resolution of 1 ms. Patch by Victor Stinner.gh-140557:
array.arraybuffers now have the same alignment when empty as when allocated. Unaligned buffers can still be created by slicing.gh-143423: Fix free-threaded build detection in the sampling profiler when Py_GIL_DISABLED is set to 0.
gh-101178: Add Ascii85, Base85, and Z85 support to
binasciiand improve the performance of the base-85 converters inbase64.gh-142966: Fix
ctypes.POINTER.set_type()not updating the format string to match the type.gh-142555:
array: fix a crash ina[i] = vwhen converting i to an index viai.__index__ori.__float__mutates the array.gh-142438: Fix _decimal builds configured with EXTRA_FUNCTIONALITY by correcting the Context.apply wrapper to pass the right argument.
gh-141860: Add an
on_errorkeyword-only parameter tomultiprocessing.set_forkserver_preload()to control how import failures during module preloading are handled. Accepts'ignore'(default, silent),'warn'(emitImportWarning), or'fail'(raise exception). Contributed by Nick Neumann and Gregory P. Smith.gh-125346: Accepting
+and/characters with an alternative alphabet inbase64.b64decode()andbase64.urlsafe_b64decode()is now deprecated. In future Python versions they will be errors in the strict mode and discarded in the non-strict mode.gh-140715: Add
'%F'support tostrptime().gh-67041: Add the missing_as_none parameter to
urlparse(),urlsplit()andurldefrag()functions. Add the keep_empty parameter tourlunparse()andurlunsplit()functions. This allows to distinguish between empty and not defined URI components and preserve empty components.gh-77188: The
picklemodule now properly handles name-mangled private methods.
IDLE¶
gh-143774: Better explain the operation of Format / Format Paragraph.
Core and Builtins¶
gh-134584: Optimize and eliminate ref-counting in
_BINARY_OP_SUBSCR_LIST_SLICEgh-144563: Fix interaction of the Tachyon profiler and
ctypesand other modules that load the Python shared library (if present) in an independent map as this was causing the mechanism that loads the binary information to be confused. Patch by Pablo Galindogh-144601: Fix crash when importing a module whose
PyInitfunction raises an exception from a subinterpreter.gh-144549: Fix building the tail calling interpreter on Visual Studio 2026 with free-threading.
gh-144513: Fix potential deadlock when using critical sections during stop-the-world pauses in the free-threaded build.
gh-131798: Optimise
_GUARD_TOS_SLICEin the JIT.gh-144330: Move
classmethodandstaticmethodinitialization from__init__()to__new__(). Patch by Victor Stinner.gh-144446: Fix data races in the free-threaded build when reading frame object attributes while another thread is executing the frame.
gh-120321: Add
gi_state,cr_state, andag_stateattributes to generators, coroutines, and async generators that return the current state as a string (e.g.,GEN_RUNNING). Theinspectmodule functionsgetgeneratorstate(),getcoroutinestate(), andgetasyncgenstate()now return these attributes directly.gh-141563: Fix thread safety of
PyDateTime_IMPORT.gh-144280: Fix a bug in JIT where the predicate symbol had no truthiness
gh-140550: In
PyModuleDef.m_slots, allow slots that repeat information present inPyModuleDef.gh-139103: Improve scaling of
namedtuple()instantiation in the free-threaded build.gh-144307: Prevent a reference leak in module teardown at interpreter finalization.
gh-144319: Add huge pages support for the pymalloc allocator. Patch by Pablo Galindo
gh-120321: Made
gi_yieldfromthread-safe in the free-threading build by using a lightweight lock on the frame state.gh-144194: Fix error handling in perf jitdump initialization on memory allocation failure.
gh-143962: Name suggestion for not normalized name suggests now the normalized name or the closest name to the normalized name. If the suggested name is not ASCII, include also its ASCII representation.
gh-144157:
bytes.translate()now allows the compiler to unroll its loop more usefully for a 2x speedup in the common no-deletions specified case.gh-144068: Fix JIT tracer memory leak, ensure the JIT tracer state is freed when daemon threads are cleaned up during interpreter shutdown.
gh-144012: Check if the result is
NULLinBINARY_OP_EXTENTopcode.gh-144007: Eliminate redundant refcounting in the JIT for
BINARY_OP.gh-144005: Eliminate redundant refcounting from
BINARY_OP_EXTEND.gh-143939: Fix erroneous “cannot reuse already awaited coroutine” error that could occur when a generator was run during the process of clearing a coroutine’s frame.
gh-141805: Fix crash in
setwhen objects with the same hash are concurrently added to the set after removing an element with the same hash while the set still contains elements with the same hash.gh-143670: Fixes a crash in
ga_repr_items_listfunction.gh-143650: Fix race condition in
importlibwhere a thread could receive a stale module reference when another thread’s import fails.gh-143569: Generator expressions in 3.15 now conform to the documented behavior when the iterable does not support iteration. This matches the behavior in 3.14 and earlier
gh-143192: Improve performance of bitwise operations on multi-digit ints.
gh-132657: If we are specializing to
LOAD_GLOBAL_MODULEorLOAD_ATTR_MODULE, try to enable deferred reference counting for the value, if the object is owned by a different thread. This applies to the free-threaded build only and should improve scaling of multi-threaded programs. Note that when deferred reference counting is enabled, the object will be deallocated by the GC, rather than byPy_DECREF().gh-143055: Implement PEP 798 (Unpacking in Comprehensions). Patch by Adam Hartz.
gh-142037: Improve error messages for printf-style formatting. For errors in the format string, always include the position of the start of the format unit. For errors related to the formatted arguments, always include the number or the name of the argument. Raise more specific errors and include more information (type and number of arguments, most probable causes of error).
gh-140557:
bytearraybuffers now have the same alignment when empty as when allocated. Unaligned buffers can still be created by slicing.gh-140232: Frozenset objects with immutable elements are no longer tracked by the garbage collector.
gh-115231: Setup
__module__attribute for built-in static methods. Patch by Sergey B Kirpichev.
C API¶
gh-143869: Added
PyLong_GetNativeLayout(),PyLongLayout,PyLongExport,PyLong_Export(),PyLong_FreeExport(),PyLongWriter,PyLongWriter_Create(),PyLongWriter_Finish()andPyLongWriter_Discard()to the limited API.gh-141070: Renamed
PyUnstable_Object_Dump()toPyObject_Dump().
Build¶
gh-140421: Disable the perf trampoline on older macOS versions where it cannot be built.
gh-144309: Build Python with POSIX 2024, instead of POSIX 2008. Patch by Victor Stinner.
gh-144278: Enables defining the
_PY_IMPL_NAMEand_PY_IMPL_CACHE_TAGpreprocessor definitions to overridesys.implementationat build time. Definitions need to include quotes when setting to a string literal. Setting the cache tag toNULLhas the effect of completely disabling automatic creation and use of.pycfiles.gh-143960: Add support for OpenSSL 3.6, drop EOL 3.2. Patch by Hugo van Kemenade.
gh-143941: Move WASI-related files to
Platforms/WASI. Along the way, leave a deprecatedTools/wasm/wasi/__main__.pybehind for backwards-compatibility.gh-143842: Prevent static builds from clashing with curses by making the optimizer COLORS table static.
Python 3.15.0 alpha 5¶
Release date: 2026-01-14
Windows¶
Tools/Demos¶
gh-142095: Make gdb ‘py-bt’ command use frame from thread local state when available. Patch by Sam Gross and Victor Stinner.
Tests¶
Library¶
gh-143706: Fix
multiprocessingforkserver so thatsys.argvis correctly set before__main__is preloaded. Previously,sys.argvwas empty during main module import in forkserver child processes. This fixes a regression introduced in 3.13.8 and 3.14.1. Root caused by Aaron Wieczorek, test provided by Thomas Watson, thanks!gh-143638: Forbid reentrant calls of the
pickle.Picklerandpickle.Unpicklermethods for the C implementation. Previously, this could cause crash or data corruption, now concurrent calls of methods of the same object raiseRuntimeError.gh-143658:
importlib.metadata: Usestr.translate()to improve performance ofimportlib.metadata.Prepared.normalize(). Patch by Hugo van Kemenade and Henry Schreiner.gh-78724: Raise
RuntimeError’s when user attempts to call methods on half-initializedStructobjects, For example, created byStruct.__new__(Struct). Patch by Sergey B Kirpichev.gh-143196: Fix crash when the internal encoder object returned by undocumented function
json.encoder.c_make_encoder()was called with non-zero second (_current_indent_level) argument.gh-143191:
_thread.stack_size()now raisesValueErrorif the stack size is too small. Patch by Victor Stinner.gh-143547: Fix
sys.unraisablehook()when the hook raises an exception and changessys.unraisablehook(): hold a strong reference to the old hook. Patch by Victor Stinner.gh-139686: Revert 0a97941245f1dda6d838f9aaf0512104e5253929 and 57db12514ac686f0a752ec8fe1c08b6daa0c6219 which made importlib.reload a no-op for lazy modules; caused Buildbot failures.
gh-143517:
annotationlib.get_annotations()no longer raises aSyntaxErrorwhen evaluating a stringified starred annotation that starts with one or more whitespace characters followed by a*. Patch by Bartosz Sławecki.gh-143474: Add
os.RWF_ATOMICconstant for Linux 6.11+.gh-143445: Speed up
copy.deepcopy()by 1.04x.gh-143378: Fix use-after-free crashes when a
BytesIOobject is concurrently mutated duringwrite()orwritelines().gh-143368: Fix endless retry loop in
profiling.samplingblocking mode when threads cannot be seized due toEPERM. Such threads are now skipped instead of causing repeated error messages. Patch by Pablo Galindo.gh-143346: Fix incorrect wrapping of the Base64 data in
plistlib._PlistWriterwhen the indent contains a mix of tabs and spaces.gh-143310:
tkinter: fix a crash when a Pythonlistis mutated during the conversion to a Tcl object (e.g., when setting a Tcl variable). Patch by Bénédikt Tran.gh-143309: Fix a crash in
os.execve()on non-Windows platforms when given a custom environment mapping which is then mutated during parsing. Patch by Bénédikt Tran.gh-143308:
pickle: fix use-after-free crashes when aPickleBufferis concurrently mutated by a custom buffer callback during pickling. Patch by Bénédikt Tran and Aaron Wieczorek.gh-142939: Performance optimisations for
difflib.get_close_matches()gh-124951: The base64 implementation behind the
binascii,base64, and related codec has been optimized for modern pipelined CPU architectures and now performs 2-3x faster across all platforms.gh-143237: Fix support of named pipes in the rotating
logginghandlers.gh-143249: Fix possible buffer leaks in Windows overlapped I/O on error handling.
gh-143241:
zoneinfo: fix infinite loop inZoneInfo.from_filewhen parsing a malformed TZif file. Patch by Fatih Celik.gh-142830:
sqlite3: fix use-after-free crashes when the connection’s callbacks are mutated during a callback execution. Patch by Bénédikt Tran.gh-143200:
xml.etree.ElementTree: fix use-after-free crashes in__getitem__()and__setitem__()methods ofElementwhen the element is concurrently mutated. Patch by Bénédikt Tran.gh-143214: Add the wrapcol parameter in
binascii.b2a_base64()andbase64.b64encode().gh-142195: Updated timeout evaluation logic in
subprocessto be compatible with deterministic environments like Shadow where time moves exactly as requested.gh-140739: Fix several crashes due to reading invalid memory in the new Tachyon sampling profiler. Patch by Pablo Galindo.
gh-142164: Fix the ctypes bitfield overflow error message to report the correct offset and size calculation.
gh-143145: Fixed a possible reference leak in ctypes when constructing results with multiple output parameters on error.
gh-143103: Add padding support to
base64.z85encode()via thepadparameter.gh-130796: Undeprecate the
locale.getdefaultlocale()function. Patch by Victor Stinner.gh-74902: Add the
iter_graphemes()function in theunicodedatamodule to iterate over grapheme clusters according to rules defined in Unicode Standard Annex #29, “Unicode Text Segmentation”. Addgrapheme_cluster_break(),indic_conjunct_break()andextended_pictographic()functions to get the properties of the character which are related to the above algorithm.gh-143004: Fix a potential use-after-free in
collections.Counter.update()when user code mutates the Counter during an update.gh-140648: The
asyncioREPL now respects the-Iflag (isolated mode). Previously, it would load and executePYTHONSTARTUPeven if the flag was set. Contributed by Bartosz Sławecki.gh-142991: Fixed socket operations such as recvfrom() and sendto() for FreeBSD divert(4) socket.
gh-116738: Make the attributes in
lzmathread-safe on the free threaded build.gh-142950: Fix regression in
argparsewhere format specifiers in help strings raisedValueError.gh-142881: Fix concurrent and reentrant call of
atexit.unregister().gh-142615: Fix possible crashes when initializing
asyncio.Taskorasyncio.Futuremultiple times. These classes can now be initialized only once and any subsequent initialization attempt will raise a RuntimeError. Patch by Kumar Aditya.gh-142517: The non-
compat32emailpolicies now correctly handle refolding encoded words that contain bytes that can not be decoded in their specified character set. Previously this resulted in an encoding exception during folding.gh-138122: The Tachyon profiler’s live TUI now integrates with the experimental
_colorizetheming system. Users can customize colors via_colorize.set_theme()(experimental API, subject to change). ALiveProfilerLighttheme is provided for light terminal backgrounds. Patch by Pablo Galindo.gh-142306: Improve errors for
Element.remove.gh-63016: Add a
flagsparameter tommap.mmap.flush()to control synchronization behavior.gh-139262: Some keystrokes can be swallowed in the new
PyREPLon Windows, especially when used together with the ALT key. Fix by Chris Eibl.gh-138897: Improved
license/copyright/creditsdisplay in the REPL: now uses a pager.gh-135852: Add
_winapi.RegisterEventSource(),_winapi.DeregisterEventSource()and_winapi.ReportEvent(). Using these functions inNTEventLogHandlerto replacepywin32.gh-109263: Starting a process from spawn context in
multiprocessingno longer sets the start method globally.gh-132715: Skip writing objects during marshalling once a failure has occurred.
Documentation¶
gh-140806: Add documentation for
enum.bin().
Core and Builtins¶
gh-134584: Eliminate redundant refcounting from
_CONTAINS_OP,_CONTAINS_OP_SETand_CONTAINS_OP_DICT.gh-143604: Fix a reference counting issue in the JIT tracer where the current executor could be prematurely freed during tracing.
gh-143469: Enable
LOAD_ATTR_MODULEspecialization even if__getattr__()is defined in module.gh-134584: Eliminate redundant refcounting from
TO_BOOL_STR.gh-143377: Fix a crash in
_interpreters.capture_exception()when the exception is incorrectly formatted. Patch by Bénédikt Tran.gh-139757: Add
BINARY_OP_SUBSCR_USTR_INTto specialize reading an ASCII character from any string. Patch by Chris Eibl.gh-141504: Factor out tracing and optimization heuristics into a single object. Patch by Donghee Na.
gh-142982: Specialize
CALL_FUNCTION_EXfor Python and non-Python callables.gh-136924: The interactive help mode in the REPL no longer incorrectly syntax highlights text input as Python code. Contributed by Olga Matoula.
gh-139757: Fix unintended bytecode specialization for non-ascii string. Patch by Donghee Na, Ken Jin and Chris Eibl.
gh-143361: Add
PY_VECTORCALL_ARGUMENTS_OFFSETto_Py_CallBuiltinClass_StackRefStealto avoid redundant allocationsgh-131798: The JIT optimizer now understands more generator instructions.
gh-134584: Eliminate redundant refcounting from
_LOAD_ATTR_SLOT.gh-143189: Fix crash when inserting a non-
strkey into a split table dictionary when the key matches an existing key in the split table but has no corresponding value in the dict.gh-143228: Fix use-after-free in perf trampoline when toggling profiling while threads are running or during interpreter finalization with daemon threads active. The fix uses reference counting to ensure trampolines are not freed while any code object could still reference them. Pach by Pablo Galindo
gh-142664: Fix a use-after-free crash in
memoryview.__hash__when the__hash__method of the referenced object mutates that object or the view. Patch by Bénédikt Tran.gh-142557: Fix a use-after-free crash in bytearray.__mod__ when the
bytearrayis mutated while formatting the%-style arguments. Patch by Bénédikt Tran.gh-143195: Fix use-after-free crashes in
bytearray.hex()andmemoryview.hex()when the separator’s__len__()mutates the original object. Patch by Bénédikt Tran.gh-143183: Fix a bug in the JIT when dealing with unsupported control-flow or operations.
gh-142975: Fix crash after unfreezing all objects tracked by the garbage collector on the free threaded build.
gh-143135: Set
sys.flags.inspectto1whenPYTHONINSPECTis0. Previously, it was set to0in this case.gh-143123: Protect the JIT against recursive tracing.
gh-143092: Fix a crash in the JIT when dealing with
list.append(x)style code.gh-143003: Fix an overflow of the shared empty buffer in
bytearray.extend()when__length_hint__()returns 0 for non-empty iterator.gh-143006: Fix a possible assertion error when comparing negative non-integer
floatandintwith the same number of bits in the integer part.gh-116738: Fix thread safety of
contextvars.Context.run().gh-142829: Fix a use-after-free crash in
contextvars.Contextcomparison when a custom__eq__method modifies the context viaset().gh-142863: Generate optimized bytecode when calling
listorsetwith generator expression.gh-41779: Allowed defining any __slots__ for a class derived from
tuple(including classes created bycollections.namedtuple()).gh-69605: Fix edge-cases around already imported modules in the REPL auto-completion of imports.
gh-138568: Adjusted the built-in
help()function so that empty inputs are ignored in interactive mode.gh-131798: Remove bounds check when indexing into tuples with a constant index.
gh-134584: Eliminate redundant refcounting from
_CALL_TYPE_1. Patch by Tomas Roungh-132108: Speed up
int.from_bytes()when passed object supports buffer protocol, likebytearrayby ~1.2x.gh-128334: Make the
sliceclass subscriptable at runtime to be consistent with typing implementation.
C API¶
gh-141671:
PyMODINIT_FUNC(and the newPyMODEXPORT_FUNC) now adds a linkage declaration (__declspec(dllexport)) on Windows.
Python 3.15.0 alpha 4¶
Release date: 2026-01-13
Tests¶
gh-142836: Accommodated Solaris in
test_pdb.test_script_target_anonymous_pipe.
Library¶
gh-122431: Corrected the error message in
readline.append_history_file()to state thatnelementsmust be non-negative instead of positive.gh-143046: The
asyncioREPL no longer prints copyright and version messages in the quiet mode (-q). Patch by Bartosz Sławecki.gh-80744: Fix issue where
pdbwould read a.pdbrctwice if launched from the home directorygh-138122: Add blocking mode to Tachyon for accurate stack traces in applications with many generators or fast-changing call stacks. Patch by Pablo Galindo.
gh-143010: Fixed a bug in
mailboxwhere the precise timing of an external event could result in the library opening an existing file instead of a file it expected to create.gh-112127: Fix possible use-after-free in
atexit.unregister()when the callback is unregistered during comparison.gh-138122: Fix incomplete stack traces in the Tachyon profiler’s frame cache when profiling code with deeply nested generators. The frame cache now validates that stack traces reach the base frame before caching, preventing broken flamegraphs. Patch by Pablo Galindo.
gh-142834: Change the
pdbcommandscommand to use the last available breakpoint instead of failing when the most recently created breakpoint was deleted.gh-142783: Fix zoneinfo use-after-free with descriptor _weak_cache. a descriptor as _weak_cache could cause crashes during object creation. The fix ensures proper reference counting for descriptor-provided objects.
gh-76007: Deprecate
VERSIONfromxml.etree.ElementTreeandversionfromxml.sax.expatreaderandxml.sax.handler. Patch by Hugo van Kemenade.gh-142784: The
asyncioREPL now properly closes the loop upon the end of interactive session. Previously, it could cause surprising warnings. Contributed by Bartosz Sławecki.gh-138122: Add binary output format to
profiling.samplingfor compact storage of profiling data. The new--binaryoption captures samples to a file that can be converted to other formats using thereplaycommand. Patch by Pablo Galindogh-142495:
collections.defaultdictnow prioritizes__setitem__()when inserting default values fromdefault_factory. This prevents race conditions where a default value would overwrite a value set beforedefault_factoryreturns.gh-142654: Show the clearer error message when using
profiling.samplingon an unknown PID.gh-142560: Fix use-after-free in
bytearraysearch-like methods (find(),count(),index(),rindex(), andrfind()) by marking the storage as exported which causes reallocation attempts to raiseBufferError. Forcontains(),split(), andrsplit()the buffer protocol is used for this.gh-142419:
mmap.mmap.set_name()method added to annotate an anonymous memory map if Linux kernel supportsPR_SET_VMA_ANON_NAME(Linux 5.17 or newer). Patch by Donghee Na.gh-139971:
pydoc: Ensure that the link to the online documentation of a stdlib module is correct.gh-124098: Fix issue where methods in handlers that lacked the protocol name but matched a valid base handler method (e.g.,
_open()orerror()) were incorrectly added tourllib.request.OpenerDirector’s handlers. Contributed by Andrea Mattei.gh-136282: Add support for
UNNAMED_SECTIONwhen creating a section via the mapping protocol access
Core and Builtins¶
gh-143057: Avoid locking in
PyTraceMalloc_Track()andPyTraceMalloc_Untrack()whentracemallocis not enabled.gh-139109: Add missing terminator in certain cases when tracing in the new JIT compiler.
gh-142961: Fix a segfault in the JIT when constant folding
len(tuple).gh-142776: Fix a file descriptor leak in import.c
gh-139757: Fix building JIT stencils on free-threaded builds.
gh-129068: Make concurrent iteration over the same range iterator thread-safe in the free threading build.
gh-142543: Fix a stack overflow on Clang JIT build configurations with full LTO.
gh-142448: Fix a bug when using monitoring with the JIT.
gh-142766: Clear the frame of a generator when
generator.close()is called.gh-134584: Eliminate redundant refcounting from
_LOAD_ATTR_INSTANCE_VALUE.gh-134584: Eliminate redundant refcounting from
_STORE_ATTR_WITH_HINT.gh-142476: Fix a memory leak in the experimental Tier 2 optimizer when creating executors. Patched by Shamil Abdulaev.
gh-100964: Fix reference cycle in exhausted generator frames. Patch by Savannah Ostrowski.
gh-139922: Allow building CPython with the tail calling interpreter on Visual Studio 2026 MSVC. This provides a performance gain over the prior interpreter for MSVC. Patch by Ken Jin, Brandt Bucher, and Chris Eibl. With help from the MSVC team including Hulon Jenkins.
Python 3.15.0 alpha 3¶
Release date: 2025-12-16
Tools/Demos¶
gh-141692: Each slice of an iOS XCframework now contains a
libfolder that contains a symlink to the libpython dylib. This allows binary modules to be compiled for iOS using dynamic libreary linking, rather than Framework linking.
Tests¶
gh-140381: Fix flaky test_profiling tests on i686 and s390x architectures by increasing slow_fibonacci call frequency from every 5th iteration to every 2nd iteration.
gh-140210: Make
test_sysconfig.test_parse_makefile_renamed_varsless fragile by clearing the environment variables before parsing the Makefile.
Security¶
gh-142145: Remove quadratic behavior in
xml.minidomnode ID cache clearing.gh-42400: Fix buffer overflow in
_Py_wrealpath()for paths exceedingMAXPATHLENbytes by using dynamic memory allocation instead of fixed-size buffer. Patch by Shamil Abdulaev.gh-119451: Fix a potential memory denial of service in the
http.clientmodule. When connecting to a malicious server, it could cause an arbitrary amount of memory to be allocated. This could have led to symptoms including aMemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.gh-119342: Fix a potential memory denial of service in the
plistlibmodule. When reading a Plist file received from untrusted source, it could cause an arbitrary amount of memory to be allocated. This could have led to symptoms including aMemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.
Library¶
gh-142754: Add the ownerDocument attribute to
xml.dom.minidomelements and attributes created by directly instantiating theElementorAttrclass. Note that this way of creating nodes is not supported; creator functions likexml.dom.Document.documentElement()should be used instead.gh-142594: Fix crash in
TextIOWrapper.close()when the underlying buffer’sclosedproperty callsdetach().gh-76007: Deprecate
__version__fromctypes. Patch by Hugo van Kemenade.gh-76007: Deprecate
__version__fromwsgiref.simple_server. Patch by Hugo van Kemenade.gh-142651:
unittest.mock: fix a thread safety issue whereMock.call_countmay return inaccurate values when the mock is called concurrently from multiple threads.gh-76007: Deprecate
__version__fromhttp.server. Patch by Hugo van Kemenade.gh-138122: Add
--subprocessesflag toprofiling.samplingCLI to automatically profile subprocesses spawned by the target. When enabled, the profiler monitors for new Python subprocesses and profiles each one separately, writing results to individual output files. This is useful for profiling applications that usemultiprocessing,ProcessPoolExecutor, or other subprocess-based parallelism. Patch by Pablo Galindo.gh-142595: Added type check during initialization of the
decimalmodule to prevent a crash in case of broken stdlib. Patch by Sergey B Kirpichev.gh-142556: Fix crash when a task gets re-registered during finalization in
asyncio. Patch by Kumar Aditya.gh-138122: Add
--mode=exceptionto the sampling profiler to capture samples only from threads with an active exception, useful for analyzing exception handling overhead. Patch by Pablo Galindo.gh-142539:
traceback: Fix location of carets inSyntaxErrors when the source contains wide characters.gh-123241: Avoid reference count operations in garbage collection of
ctypesobjects.gh-142451:
hmac: correctly copyHMACattributes for objects copied throughHMAC.copy(). Patch by Bénédikt Tran.gh-138122: The
profiling.samplingflamegraph profiler now supports inverted flamegraph view that aggregates all leaf nodes. In a standard flamegraph, if a hot function is called from multiple locations, it appears multiple times as separate leaf nodes. In the inverted flamegraph, all occurrences of the same leaf function are merged into a single aggregated node at the root, showing the total hotness of that function in one place. The children of each aggregated node represent its callers, making it easier to identify which functions consume the most CPU time and where they are called from.gh-112527: The help text for required options in
argparseno longer extended with “ (default: None)”.gh-142438: Fixed a possible leaked GIL in _PySSL_keylog_callback.
gh-138122: Add bytecode-level instruction profiling to the sampling profiler via the new
--opcodesflag. When enabled, the profiler captures which bytecode opcode is executing at each sample, including Python 3.11+ adaptive specializations, and visualizes this data in the heatmap, flamegraph, gecko, and live output formats. Patch by Pablo Galindogh-142389: Add backtick markup support in
argparsedescription and epilog text to highlight inline code when color output is enabled.gh-142346: Fix usage formatting for mutually exclusive groups in
argparsewhen they are preceded by positional arguments or followed or intermixed with other optional arguments.gh-142374: Fix cumulative percentage calculation for recursive functions in the new sampling profiler. When profiling recursive functions, cumulative statistics (cumul%, cumtime) could exceed 100% because each recursive frame in a stack was counted separately. For example, a function recursing 500 times in every sample would show 50000% cumulative presence. The fix deduplicates locations within each sample so cumulative stats correctly represent “percentage of samples where this function was on the stack”. Patch by Pablo Galindo.
gh-142315: Pdb can now run scripts from anonymous pipes used in process substitution. Patch by Bartosz Sławecki.
gh-64532: Subparser help now includes required optional arguments from the parent parser in the usage, making it clearer what arguments are needed to run a subcommand. Patch by Savannah Ostrowski.
gh-142207: Fix: profiling.sampling may cause assertion
!(has_gil && gil_requested)gh-142332: Fix usage formatting for positional arguments in mutually exclusive groups in
argparse. inargparse.gh-142282: Fix
winreg.QueryValueEx()to not accidentally read garbage buffer under race condition.gh-142318: Fix typing
'q'at the help of the interactive tachyon profiler exiting the profiler.gh-75949: Fix
argparseto preserve|separators in mutually exclusive groups when the usage line wraps due to length.gh-142267: Improve
argparseperformance by caching the formatter used for argument validation.gh-139862: Remove
colorparameter fromargparse.HelpFormatterconstructor. Color is controlled byArgumentParser.gh-68552:
MisplacedEnvelopeHeaderDefectandMissing header namedefects are now correctly passed to thehandle_defectmethod ofpolicyinFeedParser.gh-142206: The resource tracker in the
multiprocessingmodule can now understand messages from older versions of itself. This avoids issues with upgrading Python while it is running. (Note that such ‘in-place’ upgrades are not tested.)gh-142214: Fix two regressions in
dataclassesin Python 3.14.1 related to annotations.An exception is no longer raised if
slots=Trueis used and the__init__method does not have an__annotate__attribute (likely becauseinit=Falsewas used).An exception is no longer raised if annotations are requested on the
__init__method and one of the fields is not present in the class annotations. This can occur in certain dynamic scenarios.
Patch by Jelle Zijlstra.
gh-142203: Remove the debug_override parameter from
importlib.util.cache_from_source()which has been deprecated since Python 3.5.gh-138122: The
_remote_debuggingmodule now implements frame caching in theRemoteUnwinderclass to reduce memory reads when profiling remote processes. Whencache_frames=True, unchanged portions of the call stack are reused from previous samples, significantly improving profiling performance for deep call stacks.gh-116738: Fix
cmathdata race when initializing trigonometric tables with subinterpreters.gh-141982: Allow
pdbto set breakpoints on async functions with function names.gh-74389: When the stdin being used by a
subprocess.Popeninstance is closed, this is now ignored insubprocess.Popen.communicate()instead of leaving the class in an inconsistent state.gh-87512: Fix
subprocess.Popen.communicate()timeout handling on Windows when writing large input. Previously, the timeout was ignored during stdin writing, causing the method to block indefinitely if the child process did not consume input quickly. The stdin write is now performed in a background thread, allowing the timeout to be properly enforced.gh-141939: Add color to all interpolated values in
argparsehelp, like%(default)sor%(choices)s. Patch by Alex Prengère.gh-141473: When
subprocess.Popen.communicate()was called with input and a timeout and is called for a second time after aTimeoutExpiredexception before the process has died, it should no longer hang.gh-141999: Correctly allow
KeyboardInterruptto stop the process when usingprofiling.sampling.gh-142006: Fix a bug in the
email.policy.defaultfolding algorithm which incorrectly resulted in a doubled newline when a line ending at exactly max_line_length was followed by an unfoldable token.gh-141968: Remove data copy from
recompilation of regexes with large charsets by usingbytearray.take_bytes().gh-141968: Remove data copy from
encodings.idnaencode()andencode()by usingbytearray.take_bytes().gh-141968: Remove data copy from
codecspunycodeencoding by usingbytearray.take_bytes().gh-141968: Remove data copy from
wave.Wave_read.readframes()andwave.Wave_write.writeframes()by usingbytearray.take_bytes().gh-141968: Remove a data copy from
base64.b32decode()andbase64.b32encode()by usingbytearray.take_bytes().gh-59000: Fix
pdbbreakpoint resolution for class methods when the module defining the class is not imported.gh-116738: Fix thread safety issue with
rescanner objects in free-threaded builds.gh-138122: The
profiling.samplingflamegraph profiler now displays thread status statistics showing the percentage of time threads spend holding the GIL, running without the GIL, waiting for the GIL, and performing garbage collection. These statistics help identify GIL contention and thread behavior patterns. When filtering by thread, the display shows per-thread metrics.gh-141781: Fixed an issue where pdb.line_prefix assignment was ignored if assigned after the module was imported.
gh-141863: Update Streams to use
bytearray.take_bytes()for a over 10% performance improvement on pyperformance asyncio_tcp benchmark.gh-141817: Add
socket.IPV6_HDRINCLconstant.gh-105836: Fix
asyncio.run_coroutine_threadsafe()leaving underlying cancelled asyncio task running.gh-141570: Support file-like object raising
OSErrorfromfileno()in color detection (_colorize.can_colorize()). This can occur whensys.stdoutis redirected.gh-141679: Add colour to defaults in
argparsehelp. Patch by Hugo van Kemenade.gh-141686: Break reference cycles created by each call to
json.dump()orjson.JSONEncoder.iterencode().gh-141659: Fix bad file descriptor errors from
_posixsubprocesson AIX.gh-141645: Add a new
--livemode to the tachyon profiler inprofiling.samplingmodule. This mode consist of a live TUI that displays real-time profiling statistics as the target application runs, similar totop. Patch by Pablo Galindogh-141615: Check
stdininstead ofstdoutforuse_rawinputinpdb.gh-69113: Fix
doctestto correctly report line numbers for doctests in__test__dictionary when formatted as triple-quoted strings by finding unique lines in the string and matching them in the source file.gh-141600: Fix musl version detection on Void Linux.
gh-48752: Add
readline.get_pre_input_hook()function to retrieve the current pre-input hook. This allows applications to save and restore the hook without overwriting user settings. Patch by Sanyam Khurana.gh-141565: Add async-aware profiling to the Tachyon sampling profiler. The profiler now reconstructs and displays async task hierarchies in flamegraphs, making the output more actionable for users. Patch by Savannah Ostrowski and Pablo Galindo Salgado.
gh-60107: Remove a copy from
io.RawIOBase.read(). If the underlying I/O class keeps a reference to the mutable memory, raise aBufferError.gh-116738: Make csv module thread-safe on the free threaded build.
gh-140911:
collections: Ensure that the methodsUserString.rindex()andUserString.index()acceptcollections.UserStringinstances as the sub argument.gh-140875: Fix handling of unclosed character references (named and numerical) followed by the end of file in
html.parser.HTMLParserwithconvert_charrefs=False.gh-140677: Add heatmap visualization mode to the Tachyon sampling profiler. The new
--heatmapoutput format provides a line-by-line view showing execution intensity with color-coded samples, inline statistics, and interactive call graph navigation between callers and callees.gh-139946: Distinguish stdout and stderr when colorizing output in argparse module.
gh-76007:
pydoc: FixDeprecationWarningbeing raised when generating doc for stdlib modules.gh-138697: Fix inferring dest from a single-dash long option in
argparse. If a short option and a single-dash long option are passed toadd_argument(), dest is now inferred from the single-dash long option.gh-138525: Add support for single-dash long options and alternate prefix characters in
argparse.BooleanOptionalAction.gh-79986: Add parsing for
ReferencesandIn-Reply-Toheaders to theemaillibrary that parses the header content as lists of message id tokens. This prevents them from being folded incorrectly.gh-135559: Flag: a
dir()on aFlagenumeration now shows non-canonical members. (i.e. aliases).gh-134453: Fixed
subprocess.Popen.communicate()input=handling ofmemoryviewinstances that were non-byte shaped on POSIX platforms. Those are now properly cast to a byte shaped view instead of truncating the input. Windows platforms did not have this bug.gh-127930: Add
__all__totkinter.simpledialog.gh-115952: Fix a potential memory denial of service in the
picklemodule. When reading a pickled data received from untrusted source, it could cause an arbitrary amount of memory to be allocated, even if the code that is allowed to execute is restricted by overriding thefind_class()method. This could have led to symptoms including aMemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.bpo-40350: Fix support for namespace packages in
modulefinder.
Documentation¶
gh-141994:
xml.sax.handler: Make Documentation ofxml.sax.handler.feature_external_geswarn of opening up to external entity attacks. Patch by Sebastian Pipping.
Core and Builtins¶
gh-134584: Eliminate redundant refcounting from
_STORE_ATTR_INSTANCE_VALUE.gh-142718: JIT: Fix segfault caused by not flushing the stack to memory at side exits.
gh-142737: Tracebacks will be displayed in fallback mode even if
io.open()is lost. Previously, this would crash the interpreter. Patch by Bartosz Sławecki.gh-116738: Make the attributes in
bz2thread-safe on the free threaded build.gh-134584: Eliminate redundant refcounting from
_CALL_LIST_APPEND.gh-142554: Fix a crash in
divmod()when_pylong.int_divmod()does not return a tuple of length two exactly. Patch by Bénédikt Tran.gh-142531: Fix a free-threaded GC performance regression. If there are many untracked tuples, the GC will run too often, resulting in poor performance. The fix is to include untracked tuples in the “long lived” object count. The number of frozen objects is also now included since the free-threaded GC must scan those too.
gh-142402: Fix reference counting when adjacent literal parts are merged while constructing
string.templatelib.Template, preventing the displaced string object from leaking.gh-116738: Make the attributes in
zlibthread-safe on the free threaded build.gh-142343: Fix SIGILL crash on m68k due to incorrect assembly constraint.
gh-142236: Improve the “Perhaps you forgot a comma?” syntax error for multi-line string concatenations to point to the last string instead of the first, making it easier to locate where the comma is missing. Patch by Pablo Galindo.
gh-142236: Fix incorrect keyword suggestions for syntax errors in
traceback. The keyword typo suggestion mechanism would incorrectly suggest replacements when the extracted source code was incomplete rather than containing an actual typo. Patch by Pablo Galindo.gh-142305: Decrease the size of the generated stencils and the runtime JIT code. Patch by Diego Russo.
gh-135379: Implement a limited form of register allocation known as “top of stack caching” in the JIT. It works by keeping 0-3 of the top items in the stack in registers. The code generator generates multiple versions of those uops that do not escape and are relatively small. During JIT compilation, the copy that produces the least memory traffic is selected, spilling or reloading values when needed.
gh-142276: Fix missing type watcher when promoting attribute loads to constants in the JIT. Patch by Ken Jin. Reproducer by Yuancheng Jiang.
gh-142218: Fix crash when inserting into a split table dictionary with a non
strkey that matches an existing key.gh-141976: Check against abstract stack overflow in the JIT optimizer.
gh-97850: Remove all
*.load_module()usage and definitions from the import system and importlib. The method has been deprecated in favor ofimportlib.abc.Loader.exec_module()since Python 3.4.gh-142048: Fix quadratically increasing garbage collection delays in free-threaded build.
gh-65961: Stop setting
__cached__on modules.gh-141770: Annotate anonymous mmap usage only when supported by the Linux kernel and if
-X devis used or Python is built in debug mode. Patch by Donghee Na.gh-142029: Raise
ModuleNotFoundErrorinstead of crashing when a nonexistent module is used as a name in_imp.create_builtin().gh-142029: Raise
ValueErrorinstead of crashing when empty string is used as a name in_imp.create_builtin().gh-141976: Protect against specialization failures in the tracing JIT compiler for performance reasons.
gh-141861: Fix invalid memory read in the
ENTER_EXECUTORinstruction.gh-141930: When importing a module, use Python’s regular file object to ensure that writes to
.pycfiles are complete or an appropriate error is raised.gh-138122: Add incomplete sample detection to prevent corrupted profiling data. Each thread state now contains an embedded base frame (sentinel at the bottom of the frame stack) with owner type
FRAME_OWNED_BY_INTERPRETER. The profiler validates that stack unwinding terminates at this sentinel frame. Samples that fail to reach the base frame (due to race conditions, memory corruption, or other errors) are now rejected rather than being included as spurious data.gh-120158: Fix inconsistent state when enabling or disabling monitoring events too many times.
gh-140638: Expose a
"candidates"stat ingc.get_stats()andgc.callbacks.gh-141780: Fix
Py_mod_gilwith API added in PEP 793:PyModule_FromSlotsAndSpec()andPyModExporthooksgh-141732: Ensure the
__repr__()forExceptionGroupandBaseExceptionGroupdoes not change when the exception sequence that was original passed in to its constructor is subsequently mutated.gh-140638: Expose a
"duration"stat ingc.get_stats()andgc.callbacks.gh-139653: Only raise a
RecursionErroror trigger a fatal error if the stack pointer is both below the limit pointer and above the stack base. If outside of these bounds assume that it is OK. This prevents false positives when user-space threads swap stacks.gh-41779: Allowed defining the __dict__ and __weakref__ __slots__ for any class.
gh-139103: Improve multithreaded scaling of dataclasses on the free-threaded build.
gh-141589: Change
backoff counterto use prime numbers instead of powers of 2. Use only 3 bits forcounterand 13 bits forvalue. This allows to support values up to 8191. Patch by Mikhail Efimov.gh-137007: Fix a bug during JIT compilation failure which caused garbage collection debug assertions to fail.
gh-132657: For the free-threaded build, avoid locking the
setobject for the__contains__method.gh-134584: Eliminate redundant refcounting from
_CALL_STR_1.gh-134584: Eliminate redundant refcounting from
_CALL_BUILTIN_O.gh-134584: Eliminate redundant refcounting from
_CALL_TUPLE_1. Patch by Noam Cohen
C API¶
gh-142589: Fix
PyUnstable_Object_IsUniqueReferencedTemporary()handling of tagged ints on the interpreter stack.gh-142571:
PyUnstable_CopyPerfMapFile()now checks that opening the file succeeded before flushing.gh-142225: Fixed the
PyABIInfo_VARmacro.gh-141049:
_PyObject_CallMethodId(),_PyObject_GetAttrId()and_PyUnicode_FromId()are deprecated since 3.15 and will be removed in 3.20. Instead, usePyUnicode_InternFromString()and cache the result in the module state, then callPyObject_CallMethod()orPyObject_GetAttr(). Patch by Victor Stinner.gh-142163: Fix the
HAVE_THREAD_LOCALmacro being defined without thePy_BUILD_COREmacro set after includingPython.h.gh-137422: Fix free threading race condition in
PyImport_AddModuleRef(). It was previously possible for two calls to the function return two different objects, only one of which was stored insys.modules.gh-141726: Add
PyDict_SetDefaultRef()to the Stable ABI.gh-140042: Removed the sqlite3_shutdown call that could cause closing connections for sqlite when used with multiple sub interpreters.
gh-141070: Add
PyUnstable_Object_Dump()to dump an object tostderr. It should only be used for debugging. Patch by Victor Stinner.gh-139165: Expose the functions
Py_SIZE(),Py_IS_TYPE()andPy_SET_SIZE()in the Stable ABI.
Build¶
gh-131372: Add
LDVERSIONandEXEto thebase_interpretervalue ofbuild-details.json.gh-142454: When calculating the digest of the JIT stencils input, sort the hashed files by filenames before adding their content to the hasher. This ensures deterministic hash input and hence deterministic hash, independent on filesystem order.
gh-131372:
build-details.pywill only be installed as part of the main install (make install).make altinstallwill no longer include it.gh-142234: Allow
--enable-wasm-dynamic-linkingfor WASI. While CPython doesn’t directly support it so external/downstream users do not have to patch in support for the flag.gh-142050: Fixed a bug where JIT stencils produced on Windows contained debug data. Patch by Chris Eibl.
gh-141808: Do not generate the jit stencils twice in case of PGO builds on Windows.
gh-141926:
RUNSHAREDis no longer cleared when cross-compiling. Previously,RUNSHAREDwas cleared when cross-compiling, which breaks PGO when using--enabled-sharedon systems where the cross-compiled CPython is otherwise executable (e.g., via transparent emulation).gh-141808: When running
make clean-retain-profile, keep the generated JIT stencils. That way, the stencils are not generated twice when Profile-guided optimization (PGO) is used. It also allows distributors to supply their own pre-built JIT stencils.gh-141784: Fix
_remote_debugging_module.ccompilation on 32-bit Linux. Include Python.h before system headers to make sure that_remote_debugging_module.cuses the same types (ABI) than Python. Patch by Victor Stinner.gh-141172: Update to WASI SDK 29.
gh-139707: Add configure option
--with-missing-stdlib-config=FILEallows which distributors to pass a JSON configuration file containing custom error messages for missing standard library modules.gh-108819: Honor
--with-platlibdirin the pure-Python standard library installation path, ifPLATLIBDIRdoesn’t match the value used inLIBDIR.
Python 3.15.0 alpha 2¶
Release date: 2025-11-18
Windows¶
gh-140849: Update bundled liblzma to version 5.8.1.
Tools/Demos¶
Tests¶
gh-140482: Preserve and restore the state of
stty echoas part of the test environment.gh-140082: Update
python -m testto setFORCE_COLOR=1when being run with color enabled so thatunittestwhich is run by it with redirected output will output in color.gh-136442: Use exitcode
1instead of5ifunittest.TestCase.setUpClass()raises an exception
Security¶
gh-137836: Add support of the “plaintext” element, RAWTEXT elements “xmp”, “iframe”, “noembed” and “noframes”, and optionally RAWTEXT element “noscript” in
html.parser.HTMLParser.gh-136063:
email.message: ensure linear complexity for legacy HTTP parameters parsing. Patch by Bénédikt Tran.gh-136065: Fix quadratic complexity in
os.path.expandvars().
Library¶
gh-141497:
ipaddress: ensure that the methodsIPv4Network.hosts()andIPv6Network.hosts()always return an iterator.gh-140938: The
statistics.stdev()andstatistics.pstdev()functions now raise aValueErrorwhen the input contains an infinity or a NaN.gh-124111: Updated Tcl threading configuration in
_tkinterto assume that threads are always available in Tcl 9 and later.gh-137109: The
os.forkand related forking APIs will no longer warn in the common case where Linux or macOS platform APIs return the number of threads in a process and find the answer to be 1 even when aos.register_at_fork()after_in_parent=callback (re)starts a thread.gh-141314: Fix assertion failure in
io.TextIOWrapper.tell()when reading files with standalone carriage return (\r) line endings.gh-141311: Fix assertion failure in
io.BytesIO.readinto()and undefined behavior arising when read position is above capcity inio.BytesIO.gh-87710:
mimetypes: Update mime type for.aifiles toapplication/pdf.gh-85524: Update
io.FileIO.readall, an implementation ofio.RawIOBase.readall(), to followio.IOBaseguidelines and raiseio.UnsupportedOperationwhen a file is in “w” mode rather thanOSErrorgh-141141: Fix a thread safety issue with
base64.b85decode(). Contributed by Benel Tayar.gh-141018:
mimetypes: Update.exe,.dll,.rtfand (whenstrict=False).jpgto their correct IANA mime type.gh-137969: Fix
annotationlib.ForwardRef.evaluate()returningForwardRefobjects which don’t update with new globals.gh-75593: Add support of path-like objects and bytes-like objects in
wave.open().gh-140797: The undocumented
re.Scannerclass now forbids regular expressions containing capturing groups in its lexicon patterns. Patterns using capturing groups could previously lead to crashes with segmentation fault. Use non-capturing groups (?:…) instead.gh-125115: Refactor the
pdbparsing issue so positional arguments can pass through intuitively.gh-140815:
faulthandlernow detects if a frame or a code object is invalid or freed. Patch by Victor Stinner.gh-100218: Correctly set
errnowhensocket.if_nametoindex()orsocket.if_indextoname()raise anOSError. Patch by Bénédikt Tran.gh-140734:
multiprocessing: fix off-by-one error when checking the length of a temporary socket file path. Patch by Bénédikt Tran.gh-140873: Add support of non-descriptor callables in
functools.singledispatchmethod().gh-140874: Bump the version of pip bundled in ensurepip to version 25.3
gh-140826: Now
winreg.HKEYTypeobjects are compared by their underlying Windows registry handle value instead of their object identity.gh-140808: The internal class
mailbox._ProxyFileis no longer a parameterized generic.gh-140691: In
urllib.request, when opening a FTP URL fails because a data connection cannot be made, the control connection’s socket is now closed to avoid aResourceWarning.gh-103847: Fix hang when cancelling process created by
asyncio.create_subprocess_exec()orasyncio.create_subprocess_shell(). Patch by Kumar Aditya.gh-137821: Convert
_jsonmodule to use Argument Clinic. Patched by Yoonho Hann.gh-140790: Initialize all Pdb’s instance variables in
__init__, remove some hasattr/getattrgh-140766: Add
enum.show_flag_values()andenum.bintoenum.__all__.gh-120057: Add
os.reload_environ()toos.__all__.gh-140741: Fix
profiling.sampling.sample()incorrectly handling aFileNotFoundErrororPermissionError.gh-140228: Avoid making unnecessary filesystem calls for frozen modules in
linecachewhen the global module cache is not present.gh-139946: Error and warning keywords in
argparse.ArgumentParsermessages are now colorized when color output is enabled, fixing a visual inconsistency in which they remained plain text while other output was colorized.gh-140590: Fix arguments checking for the
functools.partial.__setstate__()that may lead to internal state corruption and crash. Patch by Sergey Miryanov.gh-125434: Display thread name in
faulthandleron Windows. Patch by Victor Stinner.gh-140634: Fix a reference counting bug in
os.sched_param.__reduce__().gh-140650: Fix an issue where closing
io.BufferedWritercould crash if the closed attribute raised an exception on access or could not be converted to a boolean.gh-140633: Ignore
AttributeErrorwhen setting a module’s__file__attribute when loading an extension module packaged as Apple Framework.gh-140601:
xml.etree.ElementTree.iterparse()now emits aResourceWarningwhen the iterator is not explicitly closed and was opened with a filename. This helps developers identify and fix resource leaks. Patch by Osama Abdelkader.gh-140593:
xml.parsers.expat: Fix a memory leak that could affect users withElementDeclHandler()set to a custom element declaration handler. Patch by Sebastian Pipping.gh-140607: Inside
io.RawIOBase.read(), validate that the count of bytes returned byio.RawIOBase.readinto()is valid (inside the provided buffer).gh-138162: Fix
logging.LoggerAdapterwithmerge_extra=Trueand without the extra argument.gh-140481: Improve error message when trying to iterate a Tk widget, image or font.
gh-138774:
ast.unparse()now generates full source code when handlingast.Interpolationnodes that do not have a specified source.gh-140474: Fix memory leak in
array.arraywhen creating arrays from an emptystrand theutype code.gh-140448: Change the default of
suggest_on_errortoTrueinargparse.ArgumentParser.gh-137530:
dataclassesFix annotations for generated__init__methods by replacing the annotations that were in-line in the generated source code with__annotate__functions attached to the methods.gh-140348: Fix regression in Python 3.14.0 where using the
|operator on atyping.Unionobject combined with an object that is not a type would raise an error.gh-76007:
decimal: Deprecate__version__and replace withdecimal.SPEC_VERSION.gh-76007: Deprecate
__version__fromimaplib. Patch by Hugo van Kemenade.gh-140272: Fix memory leak in the
clear()method of thedbm.gnudatabase.gh-129117:
unicodedata: Addisxidstart()andisxidcontinue()functions to check whether a character can start or continue a Unicode Standard Annex #31 identifier.gh-140251: Colorize the default import statement
import asyncioin asyncio REPL.gh-140212: Calendar’s HTML formatting now accepts year and month as options. Previously, running
python -m calendar -t html 2025 10would result in an error message. It now generates an HTML document displaying the calendar for the specified month. Contributed by Pål Grønås Drange.gh-135801: Improve filtering by module in
warnings.warn_explicit()if no module argument is passed. It now tests the module regular expression in the warnings filter not only against the filename with.pystripped, but also against module names constructed starting from different parent directories of the filename (with/__init__.py,.pyand, on Windows,.pywstripped).gh-139707: Improve
ModuleNotFoundErrorerror message when a standard library module is missing.gh-140041: Fix import of
ctypeson Android and Cygwin when ABI flags are present.gh-140120: Fixed a memory leak in
hmacwhen it was using the hacl-star backend. Discovered by@ashm-devusing AddressSanitizer.gh-140141: The
importlib.metadata.PackageNotFoundErrortraceback raised whenimportlib.metadata.Distribution.from_namecannot discover a distribution no longer includes a transientStopIterationexception trace.Contributed by Bartosz Sławecki in gh-140142.
gh-140166:
mimetypes: Per the IANA assignment, update the MIME type for the.texiand.texinfofile formats toapplication/texinfo, instead ofapplication/x-texinfo.gh-140135: Speed up
io.RawIOBase.readall()by using PyBytesWriter API (about 4x faster)gh-76007:
zlib: Deprecate__version__and schedule for removal in Python 3.20.gh-136702:
encodings: Deprecate passing a non-ascii encoding name toencodings.normalize_encoding()and schedule removal of support for Python 3.17.gh-139940: Print clearer error message when using
pdbto attach to a non-existing process.gh-139462: When a child process in a
concurrent.futures.ProcessPoolExecutorterminates abruptly, the resulting traceback will now tell you the PID and exit code of the terminated process. Contributed by Jonathan Berg.gh-63161: Fix
tokenize.detect_encoding(). Support non-UTF-8 shebang and comments if non-UTF-8 encoding is specified. Detect decoding error for non-UTF-8 encoding. Detect null bytes in source code.gh-101828: Fix
'shift_jisx0213','shift_jis_2004','euc_jisx0213'and'euc_jis_2004'codecs truncating null chars as they were treated as part of multi-character sequences.gh-139246: fix: paste zero-width in default repl width is wrong.
gh-83714: Implement
os.statx()on Linux kernel versions 4.11 and later with glibc versions 2.28 and later. Contributed by Jeffrey Bosboom and Victor Stinner.gh-138891: Fix
SyntaxErrorwheninspect.get_annotations(f, eval_str=True)is called on a function annotated with a PEP 646star_expressiongh-138859: Fix generic type parameterization raising a
TypeErrorwhen omitting aParamSpecthat has a default which is not a list of types.gh-138764: Prevent
annotationlib.call_annotate_function()from calling__annotate__functions that don’t supportVALUE_WITH_FAKE_GLOBALSin a fake globals namespace with empty globals.Make
FORWARDREFandSTRINGannotations fall back to usingVALUEannotations in the case that neither their own format, norVALUE_WITH_FAKE_GLOBALSare supported.gh-138775: Use of
python -mwithbase64has been fixed to detect input from a terminal so that it properly notices EOF.gh-98896: Fix a failure in multiprocessing resource_tracker when SharedMemory names contain colons. Patch by Rani Pinchuk.
gh-138425: Fix partial evaluation of
annotationlib.ForwardRefobjects which rely on names defined as globals.gh-138151: In
annotationlib, improve evaluation of forward references to nonlocal variables that are not yet defined when the annotations are initially evaluated.gh-69528: The
modeattribute of files opened in the'wb+'mode is now'wb+'instead of'rb+'.gh-137627: Speed up
csv.Sniffer.sniff()delimiter detection by up to 1.6x.gh-55531:
encodings: Improvenormalize_encoding()performance by implementing the function in C using the private_Py_normalize_encodingwhich has been modified to make lowercase conversion optional.gh-136057: Fixed the bug in
pdbandbdbwherenextandstepcan’t go over the line if a loop exists in the line.gh-133390: Support table, index, trigger, view, column, function, and schema completion for
sqlite3’s command-line interface.gh-135307:
email: Fix exception inset_content()when encoding text and max_line_length is set to0orNone(unlimited).gh-133789: Fix unpickling of
pathlibobjects that were pickled in Python 3.13.gh-133601: Remove deprecated
typing.no_type_check_decorator().gh-132686: Add parameters inherit_class_doc and fallback_to_class_doc for
inspect.getdoc().gh-131116:
inspect.getdoc()now correctly returns an inherited docstring oncached_propertyobjects if none is given in a subclass.gh-130693: Add support for
-nolinestop, and-strictlimitsoptions totkinter.Text.search(). Also add thetkinter.Text.search_all()method for-alland-overlapoptions.gh-122255: In the
linecachemodule and in the Python implementation of thewarningsmodule, aDeprecationWarningis issued whenmod.__loader__differs frommod.__spec__.loader(like in the C implementation of thewarningsmodule).gh-121011:
math.log()now supports arbitrary large integer-like arguments in the same way as arbitrary large integer arguments.gh-119668: Publicly expose and document
importlib.machinery.NamespacePath.gh-102431: Clarify constraints for “logical” arguments in methods of
decimal.Context.gh-81313: Add the
math.integermodule (PEP 791).
Core and Builtins¶
gh-141579: Fix
sys.activate_stack_trampoline()to properly support theperf_jitbackend. Patch by Pablo Galindo.gh-114203: Skip locking if object is already locked by two-mutex critical section.
gh-141528: Suggest using
concurrent.interpreters.Interpreter.close()instead of the private_interpreters.destroyfunction when warning about remaining subinterpreters. Patch by Sergey Miryanov.gh-141367: Specialize
CALL_LIST_APPENDinstruction only for lists, not for list subclasses, to avoid unnecessary deopt. Patch by Mikhail Efimov.gh-141312: Fix the assertion failure in the
__setstate__method of the range iterator when a non-integer argument is passed. Patch by Sergey Miryanov.gh-140643: Add support for
<GC>and<native>frames toprofiling.samplingoutput to denote active garbage collection and calls to native code.
Library¶
Core and Builtins¶
gh-140479: Update JIT compilation to use LLVM 21 at build time.
gh-140939: Fix memory leak when
bytearrayorbytesis formated with the%*bformat with a large width that results in aMemoryError.
Library¶
Core and Builtins¶
gh-140530: Fix a reference leak when
raise exc from causefails. Patch by Bénédikt Tran.
Library¶
gh-90344: Replace
io.IncrementalNewlineDecoderwith non incremental newline decoders in codebase whereio.IncrementalNewlineDecoder.decode()was being called once.
Core and Builtins¶
gh-140373: Correctly emit
PY_UNWINDevent when generator object is closed. Patch by Mikhail Efimov.gh-140729: Fix pickling error in the sampling profiler when using
concurrent.futures.ProcessPoolExecutorscript can not be properly pickled and executed in worker processes.gh-131527: Dynamic borrow checking for stackrefs is added to
Py_STACKREF_DEBUGmode. Patch by Mikhail Efimov.gh-140576: Fixed crash in
tokenize.generate_tokens()in case of specific incorrect input. Patch by Mikhail Efimov.gh-140544: Speed up accessing interpreter state by caching it in a thread local variable. Patch by Kumar Aditya.
gh-140551: Fixed crash in
dictifdict.clear()is called at the lookup stage. Patch by Mikhail Efimov and Inada Naoki.gh-140517: Fixed a reference leak when iterating over the result of
map()withstrict=Truewhen the input iterables have different lengths. Patch by Mikhail Efimov.gh-133467: Fix race when updating
type.__bases__that could allow a read oftype.__base__to observe an inconsistent value on the free threaded build.gh-140471: Fix potential buffer overflow in
ast.ASTnode initialization when encountering malformed_fieldscontaining non-str.
Library¶
gh-140443: The logarithm functions (such as
math.log10()andmath.log()) may now produce slightly different results for extremely large integers that cannot be converted to floats without overflow. These results are generally more accurate, with reduced worst-case error and a tighter overall error distribution.
Core and Builtins¶
gh-140431: Fix a crash in Python’s garbage collector due to partially initialized coroutine objects when coroutine origin tracking depth is enabled (
sys.set_coroutine_origin_tracking_depth()).gh-140476: Optimize
PySet_Add()forfrozensetin free threaded build.gh-135904: Add special labels to the assembly created during stencil creation to support relocations that the native object file format does not support. Specifically, 19 bit branches for AArch64 in Mach-O object files.
Library¶
gh-140398: Fix memory leaks in
readlinefunctionsread_init_file(),read_history_file(),write_history_file(), andappend_history_file()whenPySys_Audit()fails.
Core and Builtins¶
gh-140406: Fix memory leak when an object’s
__hash__()method returns an object that isn’t anint.gh-140358: Restore elapsed time and unreachable object count in GC debug output. These were inadvertently removed during a refactor of
gc.c. The debug log now again reports elapsed collection time and the number of unreachable objects. Contributed by Pål Grønås Drange.gh-136895: Update JIT compilation to use LLVM 20 at build time.
gh-139109: A new tracing frontend for the JIT compiler has been implemented. Patch by Ken Jin. Design for CPython by Ken Jin, Mark Shannon and Brandt Bucher.
gh-140306: Fix memory leaks in cross-interpreter channel operations and shared namespace handling.
gh-116738: Make _suggestions module thread-safe on the free threaded build.
gh-140301: Fix memory leak of
PyConfigin subinterpreters.gh-140257: Fix data race between interpreter_clear() and take_gil() on eval_breaker during finalization with daemon threads.
gh-139951: Fixes a regression in GC performance for a growing heap composed mostly of small tuples.
Counts number of actually tracked objects, instead of trackable objects. This ensures that untracking tuples has the desired effect of reducing GC overhead.
Does not track most untrackable tuples during creation. This prevents large numbers of small tuples causing excessive GCs.
gh-140253: Wrong placement of a double-star pattern inside a mapping pattern now throws a specialized syntax error. Contributed by Bartosz Sławecki in gh-140253.
gh-140104: Fix a bug with exception handling in the JIT. Patch by Ken Jin. Bug reported by Daniel Diniz.
gh-140149: Speed up parsing bytes literals concatenation by using PyBytesWriter API and a single memory allocation (about 3x faster).
gh-140061: Fixing the checking of whether an object is uniquely referenced to ensure free-threaded compatibility. Patch by Sergey Miryanov.
gh-140080: Fix hang during finalization when attempting to call
atexithandlers under no memory.gh-139871: Update
bytearrayto use abytesunder the hood as its buffer and addbytearray.take_bytes()to take it out.gh-140067: Fix memory leak in sub-interpreter creation.
gh-139914: Restore support for HP PA-RISC, which has an upwards-growing stack.
gh-139817: Attribute
__qualname__is added totyping.TypeAliasType. Patch by Mikhail Efimov.gh-135801: Many functions related to compiling or parsing Python code, such as
compile(),ast.parse(),symtable.symtable(), andimportlib.abc.InspectLoader.source_to_code()now allow to specify the module name. It is needed to unambiguous filter syntax warnings by module name.gh-139640:
ast.parse()no longer emits syntax warnings forreturn/break/continueinfinally(see PEP 765) – they are only emitted during compilation.gh-139640: Fix swallowing some syntax warnings in different modules if they accidentally have the same message and are emitted from the same line. Fix duplicated warnings in the
finallyblock.gh-139475: Changes in stackref debugging mode when
Py_STACKREF_DEBUGis set. We use the same pattern of refcounting for stackrefs as in production build.gh-139269: Fix undefined behavior when using unaligned store in JIT’s
patch_*functions.gh-138944: Fix
SyntaxErrormessage when invalid syntax appears on the same line as a validimport ... as ...orfrom ... import ... as ...statement. Patch by Brian Schubert.gh-138857: Improve
SyntaxErrormessage forcasekeyword placed outsidematchbody.gh-131253: Support the
--enable-pystatsbuild option for the free-threaded build.gh-136327: Errors when calling functions with invalid values after
*and**now do not include the function name. Patch by Ilia Solin.gh-134786: If
Py_TPFLAGS_MANAGED_DICTandPy_TPFLAGS_MANAGED_WEAKREFare used, thenPy_TPFLAGS_HAVE_GCmust be used as well.
C API¶
gh-141341: On Windows, rename the
COMPILERmacro to_Py_COMPILERto avoid name conflicts. Patch by Victor Stinner.gh-116146: Add a new
PyImport_CreateModuleFromInitfunc()C-API for creating a module from a spec and initfunc. Patch by Itamar Oren.gh-141042: Make qNaN in
PyFloat_Pack2()andPyFloat_Pack4(), if while conversion to a narrower precision floating-point format — the remaining after truncation payload will be zero. Patch by Sergey B Kirpichev.gh-141004:
Py_MATH_ElandPy_MATH_PIlare deprecated.gh-141004: The
Py_INFINITYmacro is soft deprecated.gh-140556: PEP 793: Add a new entry point for C extension modules,
PyModExport_<modulename>.gh-140487: Fix
Py_RETURN_NOTIMPLEMENTEDin limited C API 3.11 and older: don’t treatPy_NotImplementedas immortal. Patch by Victor Stinner.gh-140153: Fix
Py_REFCNT()definition on limited C API 3.11-3.13. Patch by Victor Stinner.gh-139653: Add
PyUnstable_ThreadState_SetStackProtection()andPyUnstable_ThreadState_ResetStackProtection()functions to set the stack protection base address and stack protection size of a Python thread state. Patch by Victor Stinner.
Build¶
gh-140454: When building the JIT, match the jit_stencils filename expectations in Makefile with the generator script. This avoid needless JIT recompilation during
make install.gh-140768: Warn when the WASI SDK version doesn’t match what’s supported.
gh-140513: Generate a clear compilation error when
_Py_TAIL_CALL_INTERPis enabled but eitherpreserve_noneormusttailis not supported.gh-140475: Support WASI SDK 25.
gh-140239: Check
statxavailability only on Linux (including Android).gh-140189: iOS builds were added to CI.
gh-137618:
PYTHON_FOR_REGENnow requires Python 3.10 to Python 3.15. Patch by Adam Turner.
Python 3.15.0 alpha 1¶
Release date: 2025-10-14
macOS¶
gh-115119: Update macOS installer to use libmpdecimal 4.0.1.
gh-124111: Update macOS installer to use Tcl/Tk 9.0.2.
gh-132339: Update macOS installer version of OpenSSL to 3.5.4.
gh-137450: macOS installer shell path management improvements: separate the installer
Shell profile updaterpostinstall script from theUpdate Shell Profile.commandto enable more robust error handling.gh-137134: Update macOS installer to ship with SQLite version 3.50.4.
Windows¶
gh-139810: Installing with
py install 3[.x]-devwill now select final versions as well as prereleases.gh-139573: Updated bundled version of OpenSSL to 3.0.18.
gh-138896: Fix error installing C runtime on non-updated Windows machines
gh-138314: Add
winreg.DeleteTree().gh-137136: Suppress build warnings when build on Windows with
--experimental-jit-interpreter.gh-137134: Update Windows installer to ship with SQLite 3.50.4.
gh-135099: Fix a crash that could occur on Windows when a background thread waits on a
PyMutexwhile the main thread is shutting down the interpreter.gh-130727: Fix a race in internal calls into WMI that can result in an “invalid handle” exception under high load. Patch by Chris Eibl.
gh-76023: Make
os.path.realpath()ignore Windows error 1005 when in non-strict mode.gh-133779: Reverts the change to generate different
pyconfig.hfiles based on compiler settings, as it was frequently causing extension builds to break. In particular, thePy_GIL_DISABLEDpreprocessor variable must now always be defined explicitly when compiling for the experimental free-threaded runtime. Thesysconfig.get_config_var()function can be used to determine whether the current runtime was compiled with that flag or not.gh-133626: Ensures packages are not accidentally bundled into the traditional installer.
gh-133580: Fix
sys.getwindowsversion()failing without setting an exception when called on some WinAPI partitions.gh-133572: Avoid LsaNtStatus to WinError conversion on unsupported WinAPI partitions.
gh-133568: Fix compile error when using a WinAPI partition that doesn’t support the RPC runtime library.
gh-133562: Disable handling of security descriptors by
os.mkdir()with mode0o700on WinAPI partitions that do not support it. This only affects custom builds for specialized targets.gh-133537: Avoid using console I/O in WinAPI partitions that don’t support it
gh-131942: Use the Python-specific
Py_DEBUGmacro rather than_DEBUGin Windows-related C code. Patch by Xuehai Pan.
Tools/Demos¶
gh-139330: SBOM generation tool didn’t cross-check the version and checksum values against the
Modules/expat/refresh.shscript, leading to the values becoming out-of-date during routine updates.gh-132006: XCframeworks now include privacy manifests to satisfy Apple App Store submission requirements.
gh-138171: A script for building an iOS XCframework was added. As part of this change, the top level
iOSfolder has been moved to be a subdirectory of theApplefolder.gh-137873: The iOS test runner has been simplified, resolving some issues that have been observed using the runner in GitHub Actions and Azure Pipelines test environments.
gh-137484: Have
Tools/wasm/wasiput the build Python into a directory named after the build triple instead of “build”.gh-137025: The
wasm_build.pyscript has been removed.Tools/wasm/emscriptenandTools/wasm/wasishould be used instead, as described in the Dev Guide.gh-137248: Add a
--logdiroption toTools/wasm/wasifor specifying where to write log files.gh-137243: Have Tools/wasm/wasi detect a WASI SDK install in /opt when it was directly extracted from a release tarball.
gh-136251: Fixes and usability improvements for
Tools/wasm/emscripten/web_examplegh-135968: Stubs for
stripare now provided as part of an iOS install.gh-135379: The cases generator no longer accepts type annotations on stack items. Conversions to non-default types are now done explicitly in bytecodes.c and optimizer_bytecodes.c. This will simplify code generation for top-of-stack caching and other future features.
gh-134215: REPL import autocomplete only suggests private modules when explicitly specified.
Tests¶
gh-139208: Fix regrtest
--fast-ci --verbose: don’t ignore the--verboseoption anymore. Patch by Victor Stinner.gh-138313: Restore skipped test and add janky workaround to prevent select buildbots from failing with a ResourceWarning.
gh-135966: The iOS testbed now handles the
app_packagesfolder as a site directory.gh-135494: Fix regrtest to support excluding tests from
--pgotests. Patch by Victor Stinner.gh-132815: Fix test__opcode: add
JUMP_BACKWARDto specialization stats.gh-135489: Show verbose output for failing tests during PGO profiling step with –enable-optimizations.
gh-135401: Add a new GitHub CI job to test the
sslmodule with AWS-LC as the backing cryptography and TLS library.gh-135120: Add
test.support.subTests().gh-134567: Expose log formatter to users in TestCase.assertLogs.
unittest.TestCase.assertLogs()will now optionally accept a formatter that will be used to format the strings in output if provided.gh-133744: Fix multiprocessing interrupt test. Add an event to synchronize the parent process with the child process: wait until the child process starts sleeping. Patch by Victor Stinner.
gh-133682: Fixed test case
test.test_annotationlib.TestStringFormat.test_displayswhich ensures proper handling of complex data structures (lists, sets, dictionaries, and tuples) in string annotations.gh-133639: Fix
TestPyReplAutoindent.test_auto_indent_default()doesn’t runinput_code.
Security¶
gh-139700: Check consistency of the zip64 end of central directory record. Support records with “zip64 extensible data” if there are no bytes prepended to the ZIP file.
gh-139400:
xml.parsers.expat: Make sure that parent Expat parsers are only garbage-collected once they are no longer referenced by subparsers created byExternalEntityParserCreate(). Patch by Sebastian Pipping.gh-139283:
sqlite3: correctly handle maximum number of rows to fetch inCursor.fetchmanyand reject negative values forCursor.arraysize. Patch by Bénédikt Tran.gh-136053:
marshal: fix a possible crash when deserializingsliceobjects.gh-135661: Fix parsing start and end tags in
html.parser.HTMLParseraccording to the HTML5 standard.Whitespaces no longer accepted between
</and the tag name. E.g.</ script>does not end the script section.Vertical tabulation (
\v) and non-ASCII whitespaces no longer recognized as whitespaces. The only whitespaces are\t\n\r\fand space.Null character (U+0000) no longer ends the tag name.
Attributes and slashes after the tag name in end tags are now ignored, instead of terminating after the first
>in quoted attribute value. E.g.</script/foo=">"/>.Multiple slashes and whitespaces between the last attribute and closing
>are now ignored in both start and end tags. E.g.<a foo=bar/ //>.Multiple
=between attribute name and value are no longer collapsed. E.g.<a foo==bar>produces attribute “foo” with value “=bar”.
gh-135661: Fix CDATA section parsing in
html.parser.HTMLParseraccording to the HTML5 standard:] ]>and]] >no longer end the CDATA section. Add private method_set_support_cdata()which can be used to specify how to parse<[CDATA[— as a CDATA section in foreign content (SVG or MathML) or as a bogus comment in the HTML namespace.gh-102555: Fix comment parsing in
html.parser.HTMLParseraccording to the HTML5 standard.--!>now ends the comment.-- >no longer ends the comment. Support abnormally ended empty comments<-->and<--->.gh-135462: Fix quadratic complexity in processing specially crafted input in
html.parser.HTMLParser. End-of-file errors are now handled according to the HTML5 specs – comments and declarations are automatically closed, tags are ignored.gh-118350: Fix support of escapable raw text mode (elements “textarea” and “title”) in
html.parser.HTMLParser.gh-135034: Fixes multiple issues that allowed
tarfileextraction filters (filter="data"andfilter="tar") to be bypassed using crafted symlinks and hard links.Addresses CVE 2024-12718, CVE 2025-4138, CVE 2025-4330, and CVE 2025-4517.
gh-133767: Fix use-after-free in the “unicode-escape” decoder with a non-“strict” error handler.
gh-133623: Indicate through
ssl.HAS_PSK_TLS13whether thesslmodule supports “External PSKs” in TLSv1.3, as described in RFC 9258. Patch by Will Childs-Klein.gh-128840: Short-circuit the processing of long IPv6 addresses early in
ipaddressto prevent excessive memory consumption and a minor denial-of-service.
Library¶
gh-139482: Optimize
os.environ.clear()by calling clearenv(3) when this function is available. Patch by Victor Stinner.gh-139958: The
application/tomlmime type is now supported bymimetypes. Patch by Gil Forcada.gh-139823:
ensurepipnow fails with a nicer error message when thezlibmodule is not available.gh-139905: Add suggestion to error message for
typing.Genericsubclasses whencls.__parameters__is missing due to a parent class failing to callsuper().__init_subclass__()in its__init_subclass__.gh-139894: Fix incorrect sharing of current task with the child process while forking in
asyncio. Patch by Kumar Aditya.gh-139845: Fix to not print KeyboardInterrupt twice in default asyncio REPL.
gh-139783: Fix
inspect.getsourcelines()for the case when a decorator is followed by a comment or an empty line.gh-139809: Prevent premature colorization of subparser
proginargparse.ArgumentParser.add_subparsers()to respect color environment variable changes after parser creation.gh-139736: Fix excessive indentation in the default
argparseHelpFormatter. Patch by Alexander Edland.gh-70765:
http.server: fix default handling of HTTP/0.9 requests inBaseHTTPRequestHandler. Previously,BaseHTTPRequestHandler.parse_request()incorrectly waited for headers in the request although those are not supported in HTTP/0.9. Patch by Bénédikt Tran.gh-139322: Fix
os.getlogin()error handling: fix the error number. Patch by Victor Stinner.gh-135953: Add a Gecko format output to the tachyon profiler via
--gecko.gh-139184:
os.forkpty()does now make the returned file descriptor non-inheritable.gh-139391: Fix an issue when, on non-Windows platforms, it was not possible to gracefully exit a
python -m asyncioprocess suspended by Ctrl+Z and later resumed by fg other than with kill.gh-90949: Add
SetBillionLaughsAttackProtectionActivationThreshold()andSetBillionLaughsAttackProtectionMaximumAmplification()to xmlparser objects to tune protections against billion laughs attacks. Patch by Bénédikt Tran.gh-139312: Upgrade bundled libexpat to 2.7.3
gh-139289: Do a real lazy-import on
rlcompleterinpdband restore the existing completer after importingrlcompleter.gh-90949: Add
SetAllocTrackerActivationThreshold()andSetAllocTrackerMaximumAmplification()to xmlparser objects to tune protections against disproportional amounts of dynamic memory usage from within an Expat parser. Patch by Bénédikt Tran.gh-67795: Functions that take timestamp or timeout arguments now accept any real numbers (such as
DecimalandFraction), not only integers or floats, although this does not improve precision.gh-95953: A CSS class,
diff_changed, was added to the changed lines in themake_tableoutput ofdifflib.HtmlDiff. Patch by Katie Gardner.gh-139210: Fix use-after-free when reporting unknown event in
xml.etree.ElementTree.iterparse(). Patch by Ken Jin.gh-138860: Lazy import
rlcompleterinpdbto avoid deadlock in subprocess.gh-112729: Fix crash when calling
concurrent.interpreters.create()when the process is out of memory.gh-126016: Fix an assertion failure when sending
KeyboardInterruptto a Python process running a subinterpreter in a separate thread.gh-118803:
collections.abc.ByteStringhas been removed fromcollections.abc.__all__, andtyping.ByteStringhas been removed fromtyping.__all__. The former has been deprecated since Python 3.12, and the latter has been deprecated since Python 3.9. Both classes are scheduled for removal in Python 3.17.Additionally, the following statements now cause
DeprecationWarnings to be emitted at runtime:from collections.abc import ByteString,from typing import ByteString,import collections.abc; collections.abc.ByteStringandimport typing; typing.ByteString. Both classes already causedDeprecationWarnings to be emitted if they were subclassed or used as the second argument toisinstance()orissubclass(), but they did not previously lead toDeprecationWarnings if they were merely imported or accessed from their respective modules.gh-135729: Fix unraisable exception during finalization when using
concurrent.interpretersin the REPL.gh-139076: Fix a bug in the
pydocmodule that was hiding functions in a Python module if they were implemented in an extension module and the module did not have__all__.gh-139090: Add
os.RWF_DONTCACHEconstant for Linux 6.14+.gh-139065: Fix trailing space before a wrapped long word if the line length is exactly width in
textwrap.gh-139001: Fix race condition in
pathlib.Pathon the internal_raw_pathsfield.gh-138813:
multiprocessing.BaseProcessdefaultskwargstoNoneinstead of a shared dictionary.gh-138998: Update bundled libexpat to 2.7.2
gh-118803: Add back
collections.abc.ByteStringandtyping.ByteString. Both had been removed in prior alpha, beta and release candidates for Python 3.14, but their removal has now been postponed to Python 3.17.gh-130567: Fix possible crash in
locale.strxfrm()due to a platform bug on macOS.gh-137226: Fix
typing.get_type_hints()calls on generictyping.TypedDictclasses defined with string annotations.gh-138899: Executing
quitcommand inpdbwill raisebdb.BdbQuitwhenpdbis started from an asyncio console usingbreakpoint()orpdb.set_trace().gh-138804: Raise
TypeErrorinstead ofAttributeErrorwhen an argument of incorrect type is passed toshlex.quote(). This restores the behavior of the function prior to 3.14.gh-138779: Support device numbers larger than
2**63-1for thest_rdevfield of theos.stat_resultstructure.gh-138682: Added symmetric difference support to
collections.Counterobjects.gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value for mac
gh-138720: Fix an issue where
io.BufferedWriterandio.BufferedRandomhad different definitions of “closed” forclose()andflush()which resulted in an exception when close called flush but flush thought the file was already closed.gh-138706: Update
unicodedatadatabase to Unicode 17.0.0.gh-76007: Deprecate
__version__from a number of standard library modules. Patch by Hugo van Kemenade.gh-138535: Speed up
os.stat()for files with reasonable timestamps. Contributed by Jeffrey Bosboom.gh-116946:
curses.panel: the type ofcurses.panel.new_panel()is now immutable. Patch by Bénédikt Tran.gh-116946:
zlib: the types ofzlib.compressobj()andzlib.decompressobj()are now immutable. Patch by Bénédikt Tran.gh-116946:
os: theos.DirEntrytype and the type ofos.scandir()are now immutable. Patch by Bénédikt Tran.gh-116946:
tkinter: the types_tkinter.Tcl_Obj(wrapper for Tcl objects),_tkinter.tktimertoken(obtained by callingcreatetimerhandler()on aTkapplication) and_tkinter.tkapp(the runtime type of Tk applications) are now immutable. Patch by Bénédikt Tran.gh-138514: Raise
ValueErrorwhen a multi-character string is passed to the echo_char parameter ofgetpass.getpass(). Patch by Benjamin Johnson.gh-137706: Fix the partial evaluation of annotations that use
typing.Annotated[T, x]whereTis a forward reference.gh-88375: Fix normalization of the
robots.txtrules and URLs in theurllib.robotparsermodule. No longer ignore trailing?. Distinguish raw special characters?,=and&from the percent-encoded ones.gh-99948:
ctypes.util.find_library()now works in Emscripten build.gh-111788: Fix parsing errors in the
urllib.robotparsermodule. Don’t fail trying to parse weird paths. Don’t fail trying to decode non-UTF-8robots.txtfiles.gh-138432:
zoneinfo.reset_tzpath()will now convert anyos.PathLikeobjects it receives into strings before adding them toTZPATH. It will raiseTypeErrorif anything other than a string is found after this conversion. If given anos.PathLikeobject that represents a relative path, it will now raiseValueErrorinstead ofTypeError, and present a more informative error message.gh-132657: Improve the scaling of
copy.copy()andcopy.deepcopy()in the free-threading build.gh-116946: The types of
select.poll()andselect.epoll()objects are now immutable. Patch by Bénédikt Tran.gh-116946: The
_random.RandomC type is now immutable. Patch by Bénédikt Tran.gh-57911: When extracting tar files on Windows, slashes in symlink targets will be replaced by backslashes to prevent corrupted links.
gh-138205: Removed the
resize()method on platforms that don’t support the underlying syscall, instead of raising aSystemError.gh-138008: Fix segmentation faults in the
ctypesmodule due to invalidargtypes. Patch by Dung Nguyen.gh-138252:
ssl:SSLContextobjects can now set client and server TLS signature algorithms. If Python has been built with OpenSSL 3.5 or later,SSLSocketobjects can return the signature algorithms selected on a connection.gh-138253: Add the block parameter in the
put()andget()methods of theconcurrent.interpretersqueues for compatibility with thequeue.Queueinterface.gh-60462: Fix
locale.strxfrm()on Solaris (and possibly other platforms).gh-138239: The REPL now highlights
typeas a soft keyword in type statements.gh-78502:
mmap.mmapnow has a trackfd parameter on Windows; if it isFalse, the file handle corresponding to fileno will not be duplicated.gh-138204: Forbid expansion of shared anonymous
memory mapson Linux, which caused a bus error.gh-138010: Fix an issue where defining a class with a
@warnings.deprecated-decorated base class may not invoke the correct__init_subclass__()method in cases involving multiple inheritance. Patch by Brian Schubert.gh-134716: Add support of regular expressions in the
-Woption and thePYTHONWARNINGSenvironment variable.gh-138133: Prevent infinite traceback loop when sending CTRL^C to Python through
strace.gh-138122: Implement PEP 799 – A dedicated profiling package for organizing Python profiling tools. Patch by Pablo Galindo.
gh-138092: Fixed a bug in
mmap.mmap.flush()where calling with only an offset parameter would fail.gh-138044: Remove compatibility shim for deprecated parameter package in
importlib.resources.files(). Patch by Semyon Moroz.gh-137884: Add
threading.get_native_id()support for Illumos/Solaris. Patch by Yüce Tekol.gh-134869: Fix an issue where pressing Ctrl+C during tab completion in the REPL would leave the autocompletion menu in a corrupted state.
gh-137840:
typing.TypedDictnow supports theclosedandextra_itemskeyword arguments (as described in PEP 728) to control whether additional non-required keys are allowed and to specify their value type.gh-132947: Applied changes to
importlib.metadatafrom importlib_metadata 8.7, includingdistnow disallowed forEntryPoints.select; deferred imports for faster import times; added support for metadata with newlines (python/cpython#119650); andmetadata()function now returnsNonewhen a metadata directory is present but no metadata is present.gh-90548: Fix
musldetection forplatform.libc_ver()on Alpine Linux if compiled with –strip-all.gh-137317:
inspect.signature()now correctly handles classes that use a descriptor on a wrapped__init__()or__new__()method. Contributed by Yongyu Yan.gh-137754: Fix import of the
zoneinfomodule if the C implementation of thedatetimemodule is not available.gh-125854: Improve error messages for invalid category in
warnings.warn().gh-137729:
locale.setlocale()now supports language codes with@-modifiers.@-modifier are no longer silently removed inlocale.getlocale(), but included in the language code.gh-73487: Speedup processing arguments (up to 1.5x) in the
decimalmodule methods, that now usingMETH_FASTCALLcalling convention. Patch by Sergey B Kirpichev.gh-137634: Calendar pages generated by the
calendar.HTMLCalendarclass now support dark mode and have been migrated to the HTML5 standard for improved accessibility.gh-137630: The
_interpretersmodule now uses Argument Clinic to parse arguments. Patch by Adam Turner.gh-137583: Fix a deadlock introduced in 3.13.6 when a call to
ssl.SSLSocket.recvwas blocked in one thread, and then another method on the object (such asssl.SSLSocket.send) was subsequently called in another thread.gh-92936: Update regex used by
http.cookies.SimpleCookieto handle values containing double quotes.gh-137426: Remove the code deprecation of
importlib.abc.ResourceLoader. It is documented as deprecated, but left for backwards compatibility with other classes inimportlib.abc.gh-137490: Handle
ECANCELEDin the same way asEINTRinsignal.sigwaitinfo()on NetBSD.gh-137512: Add new constants in the
resourcemodule:RLIMIT_NTHR,RLIMIT_UMTXP,RLIMIT_PIPEBUF,RLIMIT_THREADS,RLIM_SAVED_CUR, andRLIM_SAVED_MAX.gh-137044:
resource.RLIM_INFINITYis now always a positive integer. On all supported platforms, it is larger than any limited resource value, which simplifies comparison of the resource values. Previously, it could be negative, such as -1 or -3, depending on platform.gh-137477: Fix
inspect.getblock(),inspect.getsourcelines()andinspect.getsource()for generator expressions.gh-137481: Calendar uses the lengths of the locale’s weekdays to decide if the width requires abbreviation.
gh-137466: Remove undocumented
glob.glob0()andglob.glob1()functions, which have been deprecated since Python 3.13. Useglob.glob()and pass a directory to its root_dir argument instead.gh-137044: Return large limit values as positive integers instead of negative integers in
resource.getrlimit(). Accept large values and reject negative values (exceptRLIM_INFINITY) for limits inresource.setrlimit().gh-115766: Fix
ipaddress.IPv4Interface.is_unspecified.gh-75989:
tarfile.TarFile.extractall()andtarfile.TarFile.extract()now overwrite symlinks when extracting hardlinks. (Contributed by Alexander Enrique Urieles Nieto in gh-75989.)gh-137017: Fix
threading.Thread.is_aliveto remainTrueuntil the underlying OS thread is fully cleaned up. This avoids false negatives in edge cases involving thread monitoring or prematurethreading.Thread.is_alivecalls.gh-137273: Fix debug assertion failure in
locale.setlocale()on Windows.gh-137191: Fix how type parameters are collected, when
typing.Protocolare specified with explicit parameters. Now,typing.Genericandtyping.Protocolalways dictate the parameter number and parameter ordering of types. Previous behavior was a bug.gh-137282: Fix tab completion and
dir()onconcurrent.futures.gh-137257: Bump the version of pip bundled in ensurepip to version 25.2
gh-137239:
heapq: Updateheapq.__all__with*_maxfunctions.gh-124503:
ast.literal_eval()is 10-20% faster for small inputs.gh-137226: Fix behavior of
annotationlib.ForwardRef.evaluate()when the type_params parameter is passed and the name of a type param is also present in an enclosing scope.gh-137197:
SSLContextobjects can now set TLS 1.3 cipher suites viaset_ciphersuites().gh-81325:
tarfile.TarFilenow accepts a path-like when working on a tar archive. (Contributed by Alexander Enrique Urieles Nieto in gh-81325.)gh-137185: Fix a potential async-signal-safety issue in
faulthandlerwhen printing C stack traces.gh-133951: Remove lib64-lib symlink creation when creating new virtual environments in
venvmodulegh-130522: Fix unraisable
TypeErrorraised during interpreter shutdown in thethreadingmodule.gh-137059: Fix handling of file URLs with a Windows drive letter in the URL authority by
urllib.request.url2pathname(). This fixes a regression in earlier pre-releases of Python 3.14.gh-136980: Remove unused C tracing code in bdb for event type
c_call,c_returnandc_exceptiongh-130577:
tarfilenow validates archives to ensure member offsets are non-negative. (Contributed by Alexander Enrique Urieles Nieto in gh-130577.)gh-136170: Removed the unreleased
zipfile.ZipFile.data_offsetproperty added in 3.14.0a7 as it wasn’t fully clear which behavior it should have in some situations so the result was not always what a user might expect.gh-121237: Support
%:zdirective fordatetime.datetime.strptime(),datetime.time.strptime()andtime.strptime(). Patch by Lucas Esposito and Semyon Moroz.gh-136929: Ensure that hash functions guaranteed to be always available exist as attributes of
hashlibeven if they will not work at runtime due to missing backend implementations. For instance,hashlib.md5will no longer raiseAttributeErrorif OpenSSL is not available and Python has been built without MD5 support. Patch by Bénédikt Tran.gh-124621: pyrepl now works in Emscripten.
gh-136914: Fix retrieval of
doctest.DocTest.linenofor objects decorated withfunctools.cache()orfunctools.cached_property.gh-136912:
hmac.digest()now properly handles large keys and messages by falling back to the pure Python implementation when necessary. Patch by Bénédikt Tran.gh-83424: Allows creating a
ctypes.CDLLwithout name when passing a handle as an argument.gh-135228: When
dataclassesreplaces a class with a slotted dataclass, the original class can now be garbage collected again. Earlier changes in Python 3.14 caused this class to always remain in existence together with the replacement class synthesized bydataclasses.gh-136874: Discard URL query and fragment in
urllib.request.url2pathname().gh-136787:
hashlib: improve exception messages when a hash algorithm is not recognized, blocked by the current security policy or incompatible with the desired operation (for instance, using HMAC with SHAKE). Patch by Bénédikt Tran.gh-131724: In
http.client, a new max_response_headers keyword-only parameter has been added toHTTPConnectionandHTTPSConnectionconstructors. This parameter sets the maximum number of allowed response headers, helping to prevent denial-of-service attacks.gh-135427: With
-Werror, the DeprecationWarning emitted byos.fork()andos.forkpty()in mutli-threaded processes is now raised as an exception. Previously it was silently ignored. Patch by Rani Pinchuk.gh-136234: Fix
asyncio.WriteTransport.writelines()to be robust to connection failure, by using the same behavior aswrite().gh-53144:
encodings.aliases: Addlatin_Naliasesgh-136669:
_asynciois now statically linked for improved performance.gh-136134:
SMTP.auth_cram_md5()now raises anSMTPExceptioninstead of aValueErrorif Python has been built without MD5 support. In particular,SMTPclients will not attempt to use this method even if the remote server is assumed to support it. Patch by Bénédikt Tran.gh-136134:
IMAP4.login_cram_md5now raises anIMAP4.errorif CRAM-MD5 authentication is not supported. Patch by Bénédikt Tran.gh-136591:
_hashlib: avoid using deprecated functions ERR_func_error_string and EVP_MD_CTX_md when using OpenSSL 3.0 and later. Patch by Bénédikt Tran.gh-136571:
datetime.date.fromisocalendar()can now raise OverflowError for out of range arguments.gh-136549: Fix signature of
threading.excepthook().gh-136492: Expose PEP 667’s
FrameLocalsProxyTypein thetypesmodule.gh-83336:
utf8_sigis now aliased toencodings.utf_8_siggh-136523: Fix
wave.Wave_writeemitting an unraisable when open raises.gh-136507: Fix mimetypes CLI to handle multiple file parameters.
gh-52876: Add missing
keepends(defaultTrue) parameter tocodecs.StreamReaderWriter.readline()andcodecs.StreamReaderWriter.readlines().gh-136470: Correct
concurrent.futures.InterpreterPoolExecutor’s default thread name.gh-136476: Fix a bug that was causing the
get_async_stack_tracefunction to miss some frames in the stack trace.gh-136434: Fix docs generation of
UnboundIteminconcurrent.interpreterswhen running with-OO.gh-136380: Raises
AttributeErrorwhen accessingconcurrent.futures.InterpreterPoolExecutorand subinterpreters are not available.gh-72327: Suggest using the system command prompt when
pip installis typed into the REPL. Patch by Tom Viner, Richard Si, and Brian Schubert.gh-135953: Implement a new high-frequency runtime profiler that leverages the existing remote debugging functionality to collect detailed execution statistics from running Python processes. This tool is exposed in the
profile.samplemodule and enables non-intrusive observation of production applications by attaching to already-running processes without requiring any code modifications, restarts, or special startup flags. The observer can perform extremely high-frequency sampling of stack traces and interpreter state, providing detailed runtime execution analysis of live applications.gh-136021: Make
type_paramsparameter required intyping._eval_type()after a deprecation period for not providing this parameter. Also remove theDeprecationWarningfor the old behavior.gh-136286: Fix pickling failures for protocols 0 and 1 for many objects related to subinterpreters.
gh-136047: Fix issues with
typingwhen the C implementation ofabcis not available.gh-136316: Improve support for evaluating nested forward references in
typing.evaluate_forward_ref().gh-136306:
sslcan now get and set groups used for key agreement.gh-136156:
tempfile.TemporaryFile()no longer usesos.O_EXCLwithos.O_TMPFILE, so it’s possible to uselinkat()on the file descriptor. Patch by Victor Stinner.gh-133982: Update Python implementation of
io.BytesIOto be thread safe.gh-136193: Improve
TypeErrorerror message, when richcomparing twotypes.SimpleNamespaceobjects.gh-136097: Fix potential infinite recursion and KeyError in
sysconfig --generate-posix-vars.gh-85702: If
zoneinfo._common.load_tzdatais given a package without a resource azoneinfo.ZoneInfoNotFoundErroris raised rather than aPermissionError. Patch by Victor Stinner.gh-90733: Improve error messages when reporting invalid parameters in
hashlib.scrypt(). Patch by Bénédikt Tran.gh-134759: Fix
UnboundLocalErrorinemail.message.Message.get_payload()when the payload to decode is abytesobject. Patch by Kliment Lamonov.gh-136028: Fix parsing month names containing “İ” (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE) in
time.strptime(). This affects locales az_AZ, ber_DZ, ber_MA and crh_UA.gh-87135: Acquiring a
threading.Lockorthreading.RLockat interpreter shutdown will raisePythonFinalizationErrorif Python can determine that it would otherwise deadlock.gh-135995: In the palmos encoding, make byte
0x9bdecode to›(U+203A - SINGLE RIGHT-POINTING ANGLE QUOTATION MARK).gh-105456: Removed
sre_compile,sre_constantsandsre_parsemodules.gh-53203: Fix
time.strptime()for%cand%xformats on locales byn_ER, wal_ET and lzh_TW, and for%Xformat on locales ar_SA, bg_BG and lzh_TW.gh-135878: Fixes a crash of
types.SimpleNamespaceon free threading builds, when several threads were calling its__repr__()method at the same time.gh-135853: Add
math.fmax()andmath.fmin()to get the larger and smaller of two floating-point values. Patch by Bénédikt Tran.gh-135836: Fix
IndexErrorinasyncio.loop.create_connection()that could occur when non-OSErrorexception is raised during connection and socket’sclose()raisesOSError.gh-135853:
math: expose C99signbit()function to determine whether the sign bit of a floating-point value is set. Patch by Bénédikt Tran.gh-134531:
hmac: use the EVP_MAC(3ssl) interface for HMAC when Python is built with OpenSSL 3.0 and later instead of the deprecated HMAC_CTX(3ssl) interface. Patch by Bénédikt Tran.gh-135836: Fix
IndexErrorinasyncio.loop.create_connection()that could occur when the Happy Eyeballs algorithm resulted in an empty exceptions list during connection attempts.gh-135855: Raise
TypeErrorinstead ofSystemErrorwhen_interpreters.set___main___attrs()is passed a non-dict object. Patch by Brian Schubert.gh-135823:
netrc: improve the error message when the security check for the ownership of the default configuration file~/.netrcfails. Patch by Bénédikt Tran.gh-135815:
netrc: skip security checks ifos.getuid()is missing. Patch by Bénédikt Tran.gh-135640: Address bug where it was possible to call
xml.etree.ElementTree.ElementTree.write()on an ElementTree object with an invalid root element. This behavior blanked the file passed towriteif it already existed.gh-135759:
hashlib: reject negative digest lengths in OpenSSL-based SHAKE objects by raising aValueError. Previously, negative lengths were implicitly rejected by raising aMemoryErroror aSystemError. Patch by Bénédikt Tran.gh-123471: Make concurrent iterations over
itertools.chainsafe under free threading.gh-135645: Added
supports_isolated_interpretersfield tosys.implementation.gh-135646: Raise consistent
NameErrorexceptions inannotationlib.ForwardRef.evaluate()gh-135557: Fix races on
heapqupdates andlistreads on the free threaded build.gh-119180: Only fetch globals and locals if necessary in
annotationlib.get_annotations()gh-135561: Fix a crash on DEBUG builds when an HACL* HMAC routine fails. Patch by Bénédikt Tran.
gh-135386: Fix opening a
dbm.sqlite3database for reading from read-only file or directory.gh-135444: Fix
asyncio.DatagramTransport.sendto()to account for datagram header size when data cannot be sent.gh-65697:
configparser’s error message when attempting to write an invalid key is now more helpful.gh-135497: Fix
os.getlogin()failing for longer usernames on BSD-based platforms.gh-135487: Fix
reprlib.Repr.repr_int()when given integers with more thansys.get_int_max_str_digits()digits. Patch by Bénédikt Tran.gh-135429: Fix the argument mismatch in
_lsprofforPY_THROWevent.gh-135368: Fix
unittest.mock.Mockgeneration ondataclasses.dataclass()objects. Now all special attributes are set as it was before gh-124429.gh-135336:
jsonnow encodes strings up to 2.2x faster if they consist solely of characters that don’t require escaping.gh-135335:
multiprocessing: Flushstdoutandstderrafter preloading modules in theforkserver.gh-126631: Fix
multiprocessingforkserverbug which prevented__main__from being preloaded.gh-133967: Do not normalize
localename ‘C.UTF-8’ to ‘en_US.UTF-8’.gh-130870: Preserve
types.GenericAliassubclasses intyping.get_type_hints()gh-135321: Raise a correct exception for values greater than 0x7fffffff for the
BINSTRINGopcode in the C implementation ofpickle.gh-121914: Changed the names of the symbol tables for lambda expressions and generator expressions to “<lambda>” and “<genexpr>” respectively to avoid conflicts with user-defined names.
gh-135276: Synchronized zipfile.Path with zipp 3.23, including improved performance of
zipfile.Path.open()for non-reading modes, rely onfunctools.cached_property()to cache values on the instance. Rely onsave_method_argsto save the initialization method arguments. Fixed.name,.stemand other basename-based properties on Windows when working with a zipfile on disk.gh-135234:
hashlib: improve exception messages when an OpenSSL function failed. When memory allocation fails on OpenSSL’s side, aMemoryErroris raised instead of aValueError. Patch by Bénédikt Tran.gh-135244:
uuid: when the MAC address cannot be determined, the 48-bit node ID is now generated with a cryptographically-secure pseudo-random number generator (CSPRNG) as per RFC 9562, §6.10.3. This affectsuuid1()anduuid6().gh-135241: The
INTopcode of the C accelerator_picklemodule was updated to look only for “00” and “01” to push booleans onto the stack, aligning with the Pythonpicklemodule.gh-135069: Fix the “Invalid error handling” exception in
encodings.idna.IncrementalDecoderto correctly replace the ‘errors’ parameter.gh-130662: +Accept leading zeros in precision and width fields for +:class:
Decimalformatting, for exampleformat(Decimal(1.25), '.016f').gh-130662: Accept leading zeros in precision and width fields for
Fractionformatting, for exampleformat(Fraction(1, 3), '.016f').gh-135004: Rewrite and cleanup the internal
_blake2module. Some exception messages were changed but their types were left untouched. Patch by Bénédikt Tran.gh-134953: Expand
_colorizetheme withkeyword_constantand implement in repl.gh-134978:
hashlib: Supporting thestringkeyword parameter in hash function constructors such asnew()or the direct hash-named constructors such asmd5()andsha256()is now deprecated and slated for removal in Python 3.19. Prefer passing the initial data as a positional argument for maximum backwards compatibility. Patch by Bénédikt Tran.gh-134970: Fix the “unknown action” exception in
argparse.ArgumentParser.add_argument_group()to correctly replace the action class.gh-134718: By default, omit optional
Load()values inast.dump().gh-134718:
ast.dump()now only omitsNoneand[]values if they are default values.gh-134939: Add the
concurrent.interpretersmodule. See PEP 734.gh-108885: Run each example as a subtest in unit tests synthesized by
doctest.DocFileSuite()anddoctest.DocTestSuite(). Add thedoctest.DocTestRunner.report_skip()method.gh-134885: Fix possible crash in the
compression.zstdmodule related to setting parameter types. Patch by Jelle Zijlstra.gh-134857: Improve error report for
doctests run withunittest. Removedoctestmodule frames from tracebacks and redundant newline character from a failure message.gh-128840: Fix parsing long IPv6 addresses with embedded IPv4 address.
gh-133579:
curses: Consistently report failures of curses C API calls in module-level methods by raising acurses.error. This affectsassume_default_colors(),baudrate(),cbreak(),echo(),longname(),initscr(),nl(),raw(),termattrs(),termname()andunctrl(). Patch by Bénédikt Tran.gh-133579:
curses.window.refresh()andcurses.window.noutrefresh()now raise aTypeErrorinstead ofcurses.errorwhen called with an incorrect number of arguments for pads. Patch by Bénédikt Tran.gh-133579: curses.window: Consistently report failures of curses C API calls in Window methods by raising a
curses.error. This affectsaddch(),addnstr(),addstr(),border(),box(),chgat(),getbkgd(),inch(),insstr()andinsnstr(). Patch by Bénédikt Tran.gh-134771: The
time_clockid_converter()function now selects correct type forclockid_ton Cygwin which fixes a build error.gh-134637: Fix performance regression in calling a
ctypesfunction pointer in free threading.gh-134696: Built-in HACL* and OpenSSL implementations of hash function constructors now correctly accept the same documented named arguments. For instance,
md5()could be previously invoked asmd5(data=data)ormd5(string=string)depending on the underlying implementation but these calls were not compatible. Patch by Bénédikt Tran.gh-132710: If possible, ensure that
uuid.getnode()returns the same result even across different processes. Previously, the result was constant only within the same process. Patch by Bénédikt Tran.gh-134531:
_hashlib: Rename internal C functions for_hashlib.HASHand_hashlib.HASHXOFobjects. Patch by Bénédikt Tran.gh-134698: Fix a crash when calling methods of
ssl.SSLContextorssl.SSLSocketacross multiple threads.gh-134151:
email: FixTypeErrorinemail.utils.decode_params()when sorting RFC 2231 continuations that contain an unnumbered section.gh-134635:
zlib: Allow to combine Adler-32 and CRC-32 checksums viaadler32_combine()andcrc32_combine(). Patch by Callum Attryde and Bénédikt Tran.gh-134657:
asyncio: Remove some private names fromasyncio.__all__.gh-134210:
curses.window.getch()now correctly handles signals. Patch by Bénédikt Tran.gh-80334:
multiprocessing.freeze_support()now checks for work on any “spawn” start method platform rather than only on Windows.gh-134582: Fix tokenize.untokenize() round-trip errors related to t-strings braces escaping
gh-134580: Improved the styling of HTML diff pages generated by the
difflib.HtmlDiffclass, and migrated the output to the HTML5 standard.gh-134565:
unittest.doModuleCleanups()no longer swallows all but first exception raised in the cleanup code, but raises aExceptionGroupif multiple errors occurred.gh-134546: Ensure
pdbremote debugging script is readable by remote Python process.gh-134451: Converted
asyncio.tools.CycleFoundExceptionfrom dataclass to a regular exception type.gh-114177: Fix
asyncioto not close subprocess pipes which would otherwise error out when the event loop is already closed.gh-90871: Fixed an off by one error concerning the backlog parameter in
create_unix_server(). Contributed by Christian Harries.gh-134323: Fix the
threading.RLock.locked()method.gh-86802: Fixed asyncio memory leak in cancelled shield tasks. For shielded tasks where the shield was cancelled, log potential exceptions through the exception handler. Contributed by Christian Harries.
gh-71189: Add support of the all-but-last mode in
os.path.realpath().gh-72902: Improve speed (x1.1-1.8) of the
Fractionconstructor for typical inputs (float’s,Decimal’s or strings).gh-134209:
curses: Thecurses.window.instr()andcurses.window.getstr()methods now allocate their internal buffer on the heap instead of the stack; in addition, the max buffer size is increased from 1023 to 2047.gh-88994: Change
datetime.datetime.now()to half-even rounding for consistency withdatetime.datetime.fromtimestamp(). Patch by John Keith Hohm.gh-80184: The default queue size is now
socket.SOMAXCONNforsocketserver.TCPServer.gh-132983: Add
compression.zstdversion information totest.pythoninfo.gh-134235: Updated tab completion on REPL to include builtin modules. Contributed by Tom Wang, Hunter Young
gh-134152: Fixed
UnboundLocalErrorthat could occur duringemailheader parsing if an expected trailing delimiter is missing in some contexts.gh-134152:
email: Fix parsing of email message ID with invalid domain.gh-134168:
http.server: Fix IPv6 address binding and--directoryhandling when using HTTPS.gh-62184: Remove import of C implementation of
io.FileIOfrom Python implementation which has its own implementationgh-134087: Remove support for arbitrary positional or keyword arguments in the C implementation of
threading.RLockobjects. This was deprecated since Python 3.14. Patch by Bénédikt Tran.gh-134173: Speed up
asyncioperformance of transferring state from thread poolconcurrent.futures.Futureby up to 4.4x. Patch by J. Nick Koston.gh-133982: Emit
RuntimeWarningin the Python implementation ofiowhen the file-like object is not closed explicitly in the presence of multiple I/O layers.gh-133890: The
tarfilemodule now handlesUnicodeEncodeErrorin the same way asOSErrorwhen cannot extract a member.gh-134097: Fix interaction of the new REPL and
-X showrefcountcommand line option.gh-133889: The generated directory listing page in
http.server.SimpleHTTPRequestHandlernow only shows the decoded path component of the requested URL, and not the query and fragment.gh-134098: Fix handling paths that end with a percent-encoded slash (
%2for%2F) inhttp.server.SimpleHTTPRequestHandler.gh-132124: On POSIX-compliant systems,
multiprocessing.util.get_temp_dir()now ignoresTMPDIR(and similar environment variables) if the path length ofAF_UNIXsocket files exceeds the platform-specific maximum length when using the forkserver start method. Patch by Bénédikt Tran.gh-134062:
ipaddress: fix collisions in__hash__()forIPv4NetworkandIPv6Networkobjects.gh-134004:
shelveas well as underlyingdbm.dumbanddbm.sqlitenow havereorganize()methods to recover unused free space previously occupied by deleted entries.gh-133970: Make
string.templatelib.Templateandstring.templatelib.Interpolationgeneric.gh-71253: Raise
ValueErrorinopen()if opener returns a negative file-descriptor in the Python implementation ofioto match the C implementation.gh-133960: Simplify and improve
typing.evaluate_forward_ref(). It now no longer raises errors on certain invalid types. In several situations, it is now able to evaluate forward references that were previously unsupported.gh-133925: Make the private class
typing._UnionGenericAliashashable.gh-133604: Remove
platform.java_ver()which was deprecated since Python 3.13.gh-133875: Removed deprecated
pathlib.PurePath.is_reserved(). Useos.path.isreserved()to detect reserved paths on Windows.gh-133873: Remove the deprecated
getmark(),setmark()andgetmarkers()methods of theWave_readandWave_writeclasses, which were deprecated since Python 3.13. Patch by Bénédikt Tran.gh-133866: Remove the undocumented function
ctypes.SetPointerType(), which has been deprecated since Python 3.13. Patch by Bénédikt Tran.gh-133823: Remove support for
TD = TypedDict("TD")andTD = TypedDict("TD", None)calls for constructingtyping.TypedDictobjects with zero field. Patch by Bénédikt Tran.gh-125996: Fix thread safety of
collections.OrderedDict. Patch by Kumar Aditya.gh-133817: Remove support for creating
NamedTupleclasses via the undocumented keyword argument syntax. Patch by Bénédikt Tran.gh-133653: Fix
argparse.ArgumentParserwith the formatter_class argument. Fix TypeError when formatter_class is a custom subclass ofHelpFormatter. Fix TypeError when formatter_class is not a subclass ofHelpFormatterand non-standard prefix_char is used. Fix support of colorizing when formatter_class is not a subclass ofHelpFormatter.gh-133810: Remove
http.server.CGIHTTPRequestHandlerand--cgiflag from the python -m http.server command-line interface. They were deprecated in Python 3.13. Patch by Bénédikt Tran.gh-132641: Fixed a race in
functools.lru_cache()under free-threading.gh-133783: Fix bug with applying
copy.replace()toastobjects. Attributes that default toNonewere incorrectly treated as required for manually created AST nodes.gh-133684: Fix bug where
annotationlib.get_annotations()would return the wrong result for certain classes that are part of a class hierarchy wherefrom __future__ import annotationsis used.gh-77057: Fix handling of invalid markup declarations in
html.parser.HTMLParser.gh-130328: Speedup pasting in
PyREPLon Windows in a legacy console. Patch by Chris Eibl.gh-133701: Fix bug where
typing.TypedDictclasses defined underfrom __future__ import annotationsand inheriting from anotherTypedDicthad an incorrect__annotations__attribute.gh-133656: Remove deprecated
zipimport.zipimporter.load_module(). Usezipimport.zipimporter.exec_module()instead.gh-133722: Added a color option to
difflib.unified_diff()that colors output similar to git diff.gh-133489:
random.getrandbits()can now generate more that 231 bits.random.randbytes()can now generate more that 256 MiB.gh-133595: Clean up
sqlite3.ConnectionAPIs. All parameters ofsqlite3.connect()except database are now keyword-only. The first three parameters of methodscreate_function()andcreate_aggregate()are now positional-only. The first parameter of methodsset_authorizer(),set_progress_handler()andset_trace_callback()is now positional-only.gh-133581: Improve unparsing of t-strings in
ast.unparse()andfrom __future__ import annotations. Empty t-strings now round-trip correctly and formatting in interpolations is preserved. Patch by Jelle Zijlstra.gh-133577: Add parameter
formattertologging.basicConfig().gh-92897: Removed the
check_homeparameter fromsysconfig.is_python_build(), deprecated since Python 3.12.gh-133551: Support t-strings (PEP 750) in
annotationlib. Patch by Jelle Zijlstra.gh-133517: Remove
os.listdrives(),os.listvolumes()andos.listmounts()in non Windows desktop builds since the underlying functionality is missing.gh-133439: Fix dot commands with trailing spaces are mistaken for multi-line SQL statements in the sqlite3 command-line interface.
gh-133390: Support keyword completion in the
sqlite3command-line interface and addsqlite3.SQLITE_KEYWORDSconstant.gh-132493: Avoid accessing
__annotations__unnecessarily ininspect.signature().gh-133017: Improve the error message of
multiprocessing.sharedctypes.Array(),multiprocessing.sharedctypes.RawArray(),multiprocessing.sharedctypes.Value()andmultiprocessing.sharedctypes.RawValue()when an invalid typecode is passed. Patch by Tomas Roungh-132813: Improve error messages for incorrect types and values of
csv.Dialectattributes.gh-132969: Prevent the
ProcessPoolExecutorexecutor thread, which remains running whenshutdown(wait=False), from attempting to adjust the pool’s worker processes after the object state has already been reset during shutdown. A combination of conditions, including a worker process having terminated abormally, resulted in an exception and a potential hang when the still-running executor thread attempted to replace dead workers within the pool.gh-132876:
ldexp()on Windows doesn’t round subnormal results before Windows 11, but should. Python’smath.ldexp()wrapper now does round them, so results may change slightly, in rare cases of very small results, on Windows versions before 11.gh-133009:
xml.etree.ElementTree: Fix a crash inElement.__deepcopy__when the element is concurrently mutated. Patch by Bénédikt Tran.gh-132908: Add
math.isnormal()andmath.issubnormal()functions. Patch by Sergey B Kirpichev.gh-95380:
fcntl.fcntl()andfcntl.ioctl(): Remove the 1024 bytes limit on the size of not mutated bytes-like argument.gh-122781: Fix
%zdirective indatetime.datetime.strptime()to allow for no provided offset as was documented.gh-123471: Make concurrent iterations over
itertools.combinationsanditertools.productsafe under free-threading.gh-127081: Fix libc thread safety issues with
dbmby performing stateful operations in critical sections.gh-127081: Fix libc thread safety issues with
osby replacinggetloginwithgetlogin_rre-entrant version.gh-127081: Fix libc thread safety issues with
pwdby locking access togetpwall.gh-132551: Make
io.BytesIOsafe in free-threaded build.gh-107583: Fix
Flaginversion when flag set has missing values (IntFlagstill flips all bits); fix negative assigned values during flag creation (bothFlagandIntFlagignore missing values).gh-87790: Support underscore and comma as thousands separators in the fractional part for
Fraction’s formatting. Patch by Sergey B Kirpichev.gh-87790: Support underscore and comma as thousands separators in the fractional part for
Decimal’s formatting. Patch by Sergey B Kirpichev.gh-131884: Fix formatting issues in
json.dump()when both indent and skipkeys are used.gh-131788: Make
ResourceTracker.sendfrommultiprocessingre-entrant safegh-91349: Adjust default
compressionlevel=to 6 (down from 9) ingzipandtarfile. It is the default level used by most compression tools and a better tradeoff between speed and performance.gh-131146: Fix
calendar.TextCalendar,calendar.HTMLCalendar, and thecalendarCLI to display month names in the nominative case by addingcalendar.standalone_month_nameandcalendar.standalone_month_abbr, which provide month names and abbreviations in the grammatical form used when a month name stands by itself, if the locale supports it.gh-123471: Make concurrent iterations over
itertools.cyclesafe under free-threading.gh-130664: Handle corner-case for
Fraction’s formatting: treat zero-padding (preceding the width field by a zero ('0') character) as an equivalent to a fill character of'0'with an alignment type of'=', just as in case offloat’s.gh-130999: Avoid exiting the new REPL and offer suggestions even if there are non-string candidates when errors occur.
gh-88473: Implement a fast path for
datetime.dateobjects indatetime.date.today()which results in a 5x performance gain while proper subclasses retain their previous performance.gh-126883: Add check that timezone fields are in range for
datetime.datetime.fromisoformat()anddatetime.time.fromisoformat(). Patch by Semyon Moroz.gh-125028:
functools.Placeholdercannot be passed tofunctools.partial()as a keyword argument.gh-125843: If possible, indicate which
cursesC function or macro is responsible for raising acurses.errorexception. Patch by Bénédikt Tran.gh-119109:
functools.partial()calls are now faster when keyword arguments are used.gh-124033:
SimplePathis now presented inimportlib.metadata.__all__.gh-91216:
importlib.metadatanow raises aKeyErrorinstead of returningNonewhen a key is missing from the metadata.gh-120492:
importlib.metadatanow prioritizes valid dists to invalid dists when retrieving by name.gh-99631: The
shelvemodule now accepts custom serialization and deserialization functions.gh-119186: Slightly speed up
os.walk()by callingos.path.join()less often.gh-120170: Fix an issue in the
_pickleextension module in which importingmultiprocessingcould change how pickle identifies which module an object belongs to, potentially breaking the unpickling of those objects.gh-118981: Fix potential hang in
multiprocessing.popen_spawn_posixthat can happen when the child proc dies early by closing the child fds right away.gh-105497: Fix flag mask inversion when unnamed flags exist.
gh-99813:
sslnow usesSSL_sendfileinternally when it is possible (seeOP_ENABLE_KTLS). The function sends a file more efficiently because it performs TLS encryption in the kernel to avoid additional context switches. Patch by Illia Volochii.gh-62824: Fix aliases for
iso8859_8encoding. Patch by Dave Goncalves.gh-86155:
html.parser.HTMLParser.close()no longer loses data when the<script>tag is not closed. Patch by Waylan Limberg.gh-78319: UTF8 support for the IMAP APPEND command has been made RFC compliant.
gh-93334: Reraise
KeyErrorasModuleNotFoundErrorwhenimportlib.machinery.PathFinder.find_spec()is called on a submodule without importing the parent (and without apathargument).gh-69426: Fix
html.parser.HTMLParserto not unescape character entities in attribute values if they are followed by an ASCII alphanumeric or an equals sign.bpo-38735: Fix failure when importing a module from the root directory on unix-like platforms with sys.pycache_prefix set.
gh-84683:
zoneinfo: Check in<prefix>/share/zoneinfofor data files on Windowsbpo-43429: The
size()method of themmap.mmapclass now returns the size of an anonymous mapping on both Unix and Windows. Previously, the size would be returned on Windows and anOSErrorwould be raised on Unix.ValueErroris now raised instead ofOSErrorwhentrackfd=False.bpo-41839: Allow negative priority values from
os.sched_get_priority_min()andos.sched_get_priority_max()functions.bpo-28494: Improve Zip file validation false positive rate in
zipfile.is_zipfile().
IDLE¶
Documentation¶
Core and Builtins¶
gh-140000: Fix potential memory leak when a reference cycle exists between an instance of
typing.TypeAliasType,typing.TypeVar,typing.ParamSpec, ortyping.TypeVarTupleand its__name__attribute. Patch by Mikhail Efimov.gh-140009: Improve performance of list extension by dictionary items.
gh-139988: Fix a memory leak when failing to create a
Uniontype. Patch by Bénédikt Tran.gh-139748: Fix reference leaks in error branches of functions accepting path strings or bytes such as
compile()andos.system(). Patch by Bénédikt Tran.gh-139516: Fix lambda colon erroneously start format spec in f-string in tokenizer.
gh-63161: Support non-UTF-8 shebang and comments in Python source files if non-UTF-8 encoding is specified. Detect decoding error in comments for default (UTF-8) encoding. Show the line and position of decoding error for default encoding in a traceback. Show the line containing the coding cookie when it conflicts with the BOM in a traceback.
gh-139116: Prevent a deadlock when multiple threads start, stop and use
tracemallocsimultaneously.gh-139275: Fix compilation problems in
_remote_debugging_module.cwhen the system doesn’t haveprocess_vm_readv. Patch by Pablo Galindogh-133059: Increased the number of cached small positive integers from 256 to 1024.
gh-74857: PEP 538: Coerce the POSIX locale to a UTF-8 based locale. Patch by Victor Stinner.
Library¶
gh-116738: Make
mmapthread-safe on the free threaded build.
Core and Builtins¶
gh-138558: Fix handling of unusual t-string annotations in annotationlib. Patch by Dave Peck.
gh-134466: Don’t run PyREPL in a degraded environment where setting termios attributes is not allowed.
gh-138794: When a new tracing function is registered with
PyRefTracer_SetTracer(), replacing the current a call to the trace function will be made with the object set to NULL and event set toPyRefTracer_TRACKER_REMOVED. This will happen just before the new function is registered. Patch by Pablo Galindogh-71810: Raise
OverflowErrorfor(-1).to_bytes()for signed conversions when bytes count is zero. Patch by Sergey B Kirpichev.gh-138716: Improve
SyntaxErrormessage forassertin cases likeassert a := b.gh-105487: Remove non-existent
__copy__(),__deepcopy__(), and__bases__from the__dir__()entries oftypes.GenericAlias.gh-138192: Fix
contextvarsinitialization so that all subinterpreters are assigned theMISSINGvalue.gh-138479: Fix a crash when a generic object’s
__typing_subst__returns an object that isn’t atuple.gh-138431: Fix a bug in the JIT optimizer when round-tripping strings and tuples.
gh-138378: Move the globals-to-const JIT optimizer pass into to the main JIT optimizer pass
Library¶
gh-138401: Add missing validation of argument
countinos.sendfile()to be non-negative.
Core and Builtins¶
gh-138372: Fix
SyntaxWarningemitted for erroneous subscript expressions involving template string literals. Patch by Brian Schubert.gh-138302:
BINARY_OPnow specializes toBINARY_OP_ADD_INT,BINARY_OP_SUBTRACT_INTorBINARY_OP_MULTIPLY_INTif operands are compact ints.gh-138318: The default REPL now avoids highlighting built-in names (for instance
setorformat()) when they are used as attribute names (for instance invalue.setortext.format).gh-138349: Fix crash in certain cases where a module contains both a module-level annotation and a comprehension.
gh-69605: Fix some standard library submodules missing from the REPL auto-completion of imports.
gh-61206:
zipimportnow supports zstandard compressed zip file entries.
Library¶
gh-116738: Make
cProfilethread-safe on the free threaded build.
Core and Builtins¶
gh-137838: Fix JIT trace buffer overrun by increasing possible exit stubs. Patch by Donghee Na.
gh-71679: Use the same quoting algorithm for the repr of bytearrays as for bytes objects and strings – use double quotes for quoting if the bytearray contains single quotes and does not contain double quotes.
gh-137384: Fix a crash when using the
warningsmodule in a finalizer at shutdown. Patch by Kumar Aditya.
Library¶
Core and Builtins¶
gh-137992: Ensure that
PyRefTracer_SetTracer()sync with all existing threads when called to avoid races in the free threaded build. Patch by Pablo Galindogh-137967: Show error suggestions on nested attribute access. Patch by Pablo Galindo
gh-137959: Replace the shim code added to every piece of jitted code with a single trampoline function.
gh-137883: Fix runaway recursion when calling a function with keyword arguments.
gh-137079: Fix keyword typo recognition when parsing files. Patch by Pablo Galindo.
gh-137728: Fix the JIT’s handling of many local variables. This previously caused a segfault.
gh-137716: Fix double period in
AttributeErrormessage for invalid mock assertionsgh-137433: Fix a potential deadlock in the free threading build when daemon threads enable or disable profiling or tracing while the main thread is shutting down the interpreter.
gh-137576: Fix for incorrect source code being shown in tracebacks from the Basic REPL when
PYTHONSTARTUPis given. Patch by Adam Hartz.gh-37817: Allow assignment to
__bases__of direct subclasses of builtin classes.gh-132732: Optimize
_COMPARE_OP,_CONTAINS_OP,_UNARY_NEGATIVE,_UNARY_NOT, and_UNARY_INVERTin JIT builds with constant-loading uops (_POP_TWO_LOAD_CONST_INLINE_BORROWand_POP_TOP_LOAD_CONST_INLINE_BORROW), and then remove both to reduce instruction count.gh-137400: Fix a crash in the free threading build when disabling profiling or tracing across all threads with
PyEval_SetProfileAllThreads()orPyEval_SetTraceAllThreads()or their Python equivalentsthreading.settrace_all_threads()andthreading.setprofile_all_threads().gh-133143: Add
sys.abi_infoobject to make ABI information more easily accessible.gh-137400: Fix a crash in the free threading build when disabling profiling or tracing across all threads with
PyEval_SetProfileAllThreads()orPyEval_SetTraceAllThreads()or their Python equivalentsthreading.settrace_all_threads()andthreading.setprofile_all_threads().gh-120037: Disable user site packages directory when a
._pthfile is used, even if it containsimport site.gh-58124: Fix name of the Python encoding in Unicode errors of the code page codec: use “cp65000” and “cp65001” instead of “CP_UTF7” and “CP_UTF8” which are not valid Python code names. Patch by Victor Stinner.
gh-136966: The
object.__dict__and__weakref__descriptors now use a single descriptor instance per interpreter, shared across all types that need them. This speeds up class creation, and helps avoid reference cycles.gh-137314: Fixed a regression where raw f-strings incorrectly interpreted escape sequences in format specifications. Raw f-strings now properly preserve literal backslashes in format specs, matching the behavior from Python 3.11. For example,
rf"{obj:\xFF}"now correctly produces'\\xFF'instead of'ÿ'. Patch by Pablo Galindo.gh-137308: A standalone docstring in a node body is optimized as a
passstatement to ensure that the node’s body is never empty. There was aValueErrorincompile()otherwise.gh-137288: Fix bug where some bytecode instructions of a boolean expression are not associated with the correct exception handler.
gh-137291: The perf profiler can now be used if a previous frame evaluation API has been provided.
gh-134291: Remove some newer macOS API usage from the JIT compiler in order to restore compatibility with older OSX 10.15 deployment targets.
gh-88886: The codecs lookup function now again performs only minimal normalization of the encoding name before passing it to the search functions: all ASCII letters are converted to lower case, spaces are replaced with hyphens. This restores the pre-Python 3.9 behavior.
gh-131338: Disable computed stack limit checks on non-glibc linux platforms to fix crashes on deep recursion.
gh-136870: Fix data races while de-instrumenting bytecode of code objects running concurrently in threads.
gh-132732: Optimize constant comparison for
_COMPARE_OP_INT,_COMPARE_OP_FLOATand_COMPARE_OP_STRin JIT buildsgh-127598: Improve
ModuleNotFoundErrorby adding flavour text to the exception when the-Soption is passed. Patch by Andrea Mattei.gh-136801: Fix PyREPL syntax highlighting on match cases after multi-line case. Contributed by Olga Matoula.
gh-74185: The
__repr__()ofImportErrorandModuleNotFoundErrornow shows “name” and “path” asname=<name>andpath=<path>if they were given as keyword arguments at construction time. Patch by Serhiy Storchaka, Oleg Iarygin, and Yoav Nir
Library¶
gh-116738: Make functions in
syslogthread-safe on the free threaded build.gh-116738: Make functions in
pwdthread-safe on the free threaded build.
Core and Builtins¶
gh-136616: Improve
SyntaxErrorerror messages for invalidassertusages.
Library¶
Core and Builtins¶
gh-136541: Fix some issues with the perf trampolines on x86-64 and aarch64. The trampolines were not being generated correctly for some cases, which could lead to the perf integration not working correctly. Patch by Pablo Galindo.
Library¶
gh-107545: Improve the error messages that may be raised by
setsockopt().
Core and Builtins¶
gh-136517: Fixed a typo that prevented printing of uncollectable objects when the
gc.DEBUG_UNCOLLECTABLEmode was set.gh-136525: Fix issue where per-thread bytecode was not instrumented for newly created threads.
gh-132657: Improve performance of
frozensetby removing locks in the free-threading build.gh-136459: Add support for perf trampoline on macOS, to allow profilers wit JIT map support to read Python calls. While profiling,
PYTHONPERFSUPPORT=1can be appended to enable the trampoline.gh-132661:
Interpolation.expressionnow has a default, the empty string.gh-132661: Reflect recent PEP 750 change.
Disallow concatenation of
string.templatelib.Templateandstr. Also, disallow implicit concatenation of t-string literals with string or f-string literals.gh-91636: While performing garbage collection, clear weakrefs to unreachable objects that are created during running of finalizers. If those weakrefs were are not cleared, they could reveal unreachable objects.
gh-136355: Deprecate
-band-bbcommand line options and schedule them to become no-op in Python 3.17.gh-109700: Fix memory error handling in
PyDict_SetDefault().gh-135552: Fix a bug caused by the garbage collector clearing weakrefs too early. The weakrefs in the
tp_subclassesdictionary are needed in order to correctly invalidate type caches (for example, by callingPyType_Modified()). Clearing weakrefs before calling finalizers causes the caches to not be correctly invalidated. That can cause crashes since the caches can refer to invalid objects. Defer the clearing of weakrefs without callbacks until after finalizers are executed.gh-136203: Improve
TypeErrorerror message, when richcomparing twotypes.MappingProxyTypeobjects.gh-136003: Fix
threading.Threadobjects becoming incorrectly daemon when created from anatexitcallback or a pending call (Py_AddPendingCall()).gh-78465: Fix error message for
cls.__new__(cls, ...)whereclsis not instantiable builtin or extension type (withtp_newset toNULL).gh-135904: Perform more aggressive control-flow optimizations on the machine code templates emitted by the experimental JIT compiler.
gh-129958: Differentiate between t-strings and f-strings in syntax error for newlines in format specifiers of single-quoted interpolated strings.
gh-135871: Non-blocking mutex lock attempts now return immediately when the lock is busy instead of briefly spinning in the free threading build.
gh-134584: Specialize
POP_TOPin the JIT compiler by specializing for reference lifetime and type. This will also enable easier top of stack caching in the JIT compiler.gh-135106: Restrict the trashcan mechanism to GC’ed objects and untrack them while in the trashcan to prevent the GC and trashcan mechanisms conflicting.
gh-135379: Changes specialization of
BINARY_OPfor ints to only specialize for “compact” ints. This streamlines the fast path at the cost of fewer specializations when very large integers are used.gh-135607: Fix potential
weakrefraces in an object’s destructor on the free threaded build.gh-135608: Fix a crash in the JIT involving attributes of modules.
gh-82088: Improve performance of
PyLongObjectconversion functionsPyLong_AsLongAndOverflow(),PyLong_AsSsize_t(),PyLong_AsUnsignedLong(),PyLong_AsSize_t(),PyLong_AsUnsignedLongMask(),PyLong_AsUnsignedLongLongMask(),PyLong_AsLongLongAndOverflow()for integers larger than 2**30 up to 30%.gh-135551: Sorting randomly ordered lists will often run a bit faster, thanks to a new scheme for picking minimum run lengths from Stefan Pochmann, which arranges for the merge tree to be as evenly balanced as is possible.
gh-135543: Emit
sys.remote_execaudit event whensys.remote_exec()is called and migrateremote_debugger_scripttocpython.remote_debugger_script.gh-135496: Fix typo in the f-string conversion type error (“exclamanation” -> “exclamation”).
gh-135474: Specialize integer operations only on compact integers. This is a CPython internal change.
gh-135371: Fixed
asynciodebugging tools to properly display internal coroutine call stacks alongside external task dependencies. Thepython -m asyncio psandpython -m asyncio pstreecommands now show complete execution context. Patch by Pablo Galindo.gh-135422: Fix regression in
SyntaxErrormessages after gh-134036.
Library¶
gh-116738: Make functions in
grpthread-safe on the free threaded build.gh-127319: Set the
allow_reuse_portclass variable toFalseon the XMLRPC, logging, and HTTP servers. This matches the behavior in prior Python releases, which is to not allow port reuse.
Core and Builtins¶
gh-130077: Properly raise custom syntax errors when incorrect syntax containing names that are prefixes of soft keywords is encountered. Patch by Pablo Galindo.
gh-131798: Optimize _CALL_LEN in the JIT when the length is known. Patch by Tomas Roun
gh-131798: Optimize
_UNARY_NEGATIVEin JIT-compiled code.gh-135148: Fixed a bug where f-string debug expressions (using =) would incorrectly strip out parts of strings containing escaped quotes and # characters. Patch by Pablo Galindo.
gh-131798: Optimize
_UNARY_INVERTin JIT-compiled code.gh-131798: Optimize away
_CALL_TYPE_1in the JIT when the return type is known. Patch by Tomas Roungh-133136: Limit excess memory usage in the free threading build when a large dictionary or list is resized and accessed by multiple threads.
gh-131798: Optimize
_CHECK_METHOD_VERSIONinto_CHECK_FUNCTION_VERSION_INLINEin JIT-compiled code.
Library¶
gh-116738: Make methods in
heapqthread-safe on the free threaded build.
Core and Builtins¶
gh-134280: Disable constant folding for
~with a boolean argument. This moves the deprecation warning from compile time to runtime.gh-134876: Add support to PEP 768 remote debugging for Linux kernels which don’t have CONFIG_CROSS_MEMORY_ATTACH configured.
gh-134889: Fix handling of a few opcodes that leave operands on the stack when optimizing
LOAD_FAST.
Library¶
gh-134908: Fix crash when iterating over lines in a text file on the free threaded build.
Core and Builtins¶
gh-132617: Fix
dict.update()modification check that could incorrectly raise a “dict mutated during update” error when a different dictionary was modified that happens to share the same underlying keys object.gh-131798: Allow the JIT to remove unnecessary
_ITER_CHECK_TUPLEops.gh-134679: Fix crash in the free threading build’s QSBR code that could occur when changing an object’s
__dict__attribute.gh-133912: Fix the C API function
PyObject_GenericSetDictto handle extension classes with inline values.gh-131798: Make the JIT optimizer understand that slicing a string/list/tuple returns the same type.
gh-134584: Add a reference count elimination pass to the JIT compiler. Patch by Ken Jin.
gh-131798: Optimize
_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW.
Library¶
gh-134381: Fix
RuntimeErrorwhen using a not-startedthreading.Threadafter callingos.fork()
Core and Builtins¶
gh-127960: PyREPL interactive shell no longer starts with
__package__and__file__global names set to_pyreplpackage internals. Contributed by Yuichiro Tachibana.gh-130397: Remove special-casing for C stack depth limits for WASI. Due to WebAssembly’s built-in stack protection this does not pose a security concern.
gh-131798: JIT: replace
_LOAD_SMALL_INTwith_LOAD_CONST_INLINE_BORROWgh-131798: Improve the JIT’s ability to optimize away cached class attribute and method loads.
gh-128066: Fixes an edge case where PyREPL improperly threw an error when Python is invoked on a read only filesystem while trying to write history file entries.
gh-131798: Improve the JIT’s ability to narrow unknown classes to constant values.
gh-134268: Add
_POP_CALL_TWO_LOAD_CONST_INLINE_BORROWand use it to further optimizeCALL_ISINSTANCE.gh-131798: Split
CALL_LIST_APPENDinto several uops. Patch by Diego Russo.gh-69605: When auto-completing an import in the REPL, finding no candidates now issues no suggestion, rather than suggestions from the current namespace.
gh-134170: Add colorization to
sys.unraisablehook()by default.gh-91153: Fix a crash when a
bytearrayis concurrently mutated during item assignment.gh-134158: Fix coloring of double braces in f-strings and t-strings in the REPL.
gh-134119: Fix crash when calling
next()on an exhausted template string iterator. Patch by Jelle Zijlstra.gh-134100: Fix a use-after-free bug that occurs when an imported module isn’t in
sys.modulesafter its initial import. Patch by Nico-Posada.gh-134036: Improve
SyntaxErrormessage when using invalidraisestatements.gh-133999: Fix
SyntaxErrorregression inexceptparsing after gh-123440.gh-133886: Fix
sys.remote_exec()for non-ASCII paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales.gh-133400: Fixed Ctrl+D (^D) behavior in _pyrepl module to match old pre-3.13 REPL behavior.
gh-133703: Fix hashtable in dict can be bigger than intended in some situations.
gh-133778: Fix bug where assigning to the
__annotations__attributes of classes defined underfrom __future__ import annotationshad no effect.gh-133711: Implement PEP 686: Enable Python UTF-8 Mode by default. Patch by Adam Turner.
gh-132762:
fromkeys()no longer loops forever when adding a small set of keys to a large base dict. Patch by Angela Liss.gh-133541: Inconsistent indentation in user input crashed the new REPL when syntax highlighting was active. This is now fixed.
gh-133516: Raise
ValueErrorwhen constantsTrue,FalseorNoneare used as an identifier after NFKC normalization.gh-131798: Allow the JIT to remove int guards after
_GET_LENby setting the return type to int.gh-131798: Split
CALL_ISINSTANCEinto several uops, allowing the JIT to remove some of them.gh-132554: Change iteration to use “virtual iterators” for sequences. Instead of creating an iterator, a tagged integer representing the next index is pushed to the stack above the iterable. For non-sequence iterators,
NULLis pushed.gh-130821: Enhance wrong type error messages and make them more consistent. Patch by Semyon Moroz.
gh-131798: Narrow the return type and constant-evaluate
CALL_ISINSTANCEfor a subset of known values in the JIT. Patch by Tomas Roungh-132542: Update
Thread.native_idafter fork(2) to ensure accuracy. Patch by Noam Cohen.
Library¶
gh-132732: Automatically constant evaluate bytecode operations marked as pure in the JIT optimizer.
Core and Builtins¶
gh-127971: Fix off-by-one read beyond the end of a string in string search.
gh-132042: Improve class creation times by up to 12% by pre-computing type slots just once. Patch by Sergey Miryanov.
gh-133379: Correct usage of arguments in error messages.
gh-127266: In the free-threaded build, avoid data races caused by updating type slots or type flags after the type was initially created. For those (typically rare) cases, use the stop-the-world mechanism. Remove the use of atomics when reading or writing type flags. The use of atomics is not sufficient to avoid races (since flags are sometimes read without a lock and without atomics) and are no longer required.
gh-130425: Add
"Did you mean: 'attr'?"suggestion when usingdel obj.attrifattrdoes not exist.gh-128640: Fix a crash when using threads inside of a subinterpreter.
Library¶
Core and Builtins¶
gh-119494: Exception text when trying to delete attributes of types was clarified.
C API¶
gh-139924: Function watchers can now receive a PyFunction_PYFUNC_EVENT_MODIFY_QUALNAME event when a watched functions qualname is changed.
gh-111489: Add
PyTuple_FromArray()to create atuplefrom an array. Patch by Victor Stinner.gh-136355: Deprecate
PyConfig.bytes_warningfield and schedule its removal in 3.17.gh-138886: Remove deprecated
PySys_ResetWarnOptions()C-API function.gh-129813: Implement PEP 782, the
PyBytesWriterAPI. Add functions:Patch by Victor Stinner.
gh-137956: Display and raise an exception if an extension compiled for non-free-threaded Python is loaded in a free-threaded interpreter.
gh-137573: Mark
_PyOptimizer_OptimizeasPy_NO_INLINEto prevent stack overflow crashes on macOS.gh-128813: Functions
_Py_c_sum(),_Py_c_diff(),_Py_c_neg(),_Py_c_prod(),_Py_c_quot(),_Py_c_pow()and previously undocumented_Py_c_abs()are soft deprecated. Deprecate alsocvalfield of thePyComplexObjecttype. Patch by Sergey B Kirpichev.gh-137210: Add API for checking an extension module�