Changelog

Python next

Release date: XXXX-XX-XX

Tools/Demos

  • gh-154059: Fix the time units in Tachyon flame graph tooltips by accounting for the sampling interval when converting samples to milliseconds.

Security

Library

  • gh-155869: Fix reorganize() in dbm.dumb failing to persist updated value offsets, which could cause data loss after reopening the database.

  • gh-155702: Fix sqlite3.Blob slice assignment with a step. It patched the bytes object read from the blob, which for a single byte is an immortal singleton, so that the value of that byte was changed in the whole process.

  • gh-155519: Avoid a data-race in free-threaded builds when reading and writing context variables from different threads.

  • gh-155009: Fix argparse.ArgumentParser to preserve the program name from sys.argv[0] when a named module is executed as the main program without replacing sys.argv[0].

  • gh-155063: Bump the version of pip bundled in ensurepip to version 26.2.1

  • gh-153711: On macOS, add run-time checks around the syscalls pipe2 (2) and dup3 (2), in addition to the existing build-time checks. This means that Python built on macOS 27 (where these calls are available) can run on macOS 26 (where they aren’t).

  • gh-154871: Fixed a crash in asyncio.Task.get_context() when called on an uninitialized task.

  • gh-154568: Fix array unpickling of little-endian float16.

  • gh-154566: Fix array.array.byteswap() corrupting data for 'Zd' (complex double) arrays with more than one element: the 16-byte item loop advanced the buffer pointer by only 8 bytes per iteration, causing items after the first to be scrambled.

  • gh-154086: Store per-thread sample counts in Tachyon flamegraphs so filtering a thread updates frame widths and totals.

  • gh-153158: Remove the erroneous width argument of calendar.HTMLCalendar.formatmonthpage(), which could drop the year from the heading.

  • gh-113329: Fix OSError being raised when trying to run doctests on a class objects in the REPL. Patch by Sten Wessel.

Core and Builtins

  • gh-155752: Fix a crash when a types.GenericAlias argument gains a __typing_subst__ hook after the alias parameters have been cached.

  • gh-155515: Track the internal HAMT iterators, which back iteration over a contextvars.Context, with the garbage collector. A reference cycle running through such an iterator was never collected, leaking the whole context it iterated over.

  • gh-155400: Fix a deadlock in the free-threaded build between two threads assigning to a special method of the same class. While applying the type slot updates with the world stopped, only the type lock was prevented from being released; the type dict mutex could still be released and re-acquired, in the wrong order, if the thread blocked on the stop-the-world mutex.

  • gh-155363: Fix a leak in the free-threaded build when creating a thread state fails after an internal QSBR slot has been reserved for it. The slot could never be reclaimed, so the QSBR array grew without bound across repeated failures.

  • gh-154196: Improve AttributeError messages from unresolved lazy imports. Patch by Bartosz Sławecki.

  • gh-151377: Fix races in free-threaded builds when updating type slots for newly created classes and when removing entries from a base type’s subclasses dictionary.

  • gh-148817: Fold large constant list and set literals used as the iterable of a for loop or in/not in test into a constant tuple or frozenset, restoring an optimization previously done by the AST optimizer that was lost when constant folding moved to the CFG.

  • gh-85260: compile() now raises ValueError instead of crashing on a debug build if an identifier field of an AST node (such as the name of a function, a class, an imported module or a caught exception) is "None", "True" or "False".

Python 3.15.0 release candidate 1

Release date: 2026-08-04

Security

Core and Builtins

  • gh-154902: Fix a crash when __conditional_annotations__ is rebound to a non-set object.

  • gh-133931: Fix data races when setting attributes of function objects on the free threaded build.

  • gh-154775: When matching a complex literal in case statements, an extraneous + sign (for example, 1++1j or 1-+1j) is no longer allowed.

  • gh-154709: Fix an out-of-bounds access in reverse dictionary iterators when the underlying dictionary is cleared and modified after the iterator is created.

  • gh-154695: Fix asyncio.Task raising AttributeError when created with eager_start=True and no explicit loop argument.

  • gh-153809: Fix interpreter crash while deallocating objects of asyncio.Task on free-threaded builds. Contributed by Sergey Miryanov.

  • gh-154275: Fix a crash when getting deeply nested __parameters__ from a types.GenericAlias objects.

  • gh-154014: Fix a JIT assertion during interpreter shutdown by initializing vm_data fields for cold executors that bypass _Py_ExecutorInit().

  • gh-153932: Fix thread safety issue in the __reduce__ method of enumerate.

  • gh-153881: Fix potential data race when calling __getstate__() under the free-threaded build.

  • gh-153570: Fix a use-after-free in bytearray.take_bytes() when the argument’s __index__() method resizes the bytearray. Patch by tonghuaroot.

  • gh-153419: Fix multiple bytearray crashes and reference leaks caused by skipping __init__() and broken state setup code.

  • gh-153236: Propagate exceptions raised while importing lazy submodules instead of reporting them as missing attributes.

  • gh-148874: Ignore interrupts immediately after calling the __enter__ method of a context menager in a with statement. This ensures that the __exit__ method is always called in a with statement.

  • gh-150208: Avoid double-quoting string values from pyconfig.h in sysconfigdata variables.

Library

Documentation

  • gh-118150: Clarify in the difflib documentation what junk actually does, its drawbacks, and how to control it.

Tests

  • gh-76595: Add C API tests for PyCapsule_Import().

  • gh-154211: Add test.support.skip_if_huge_c_stack() and use it to skip tests that exhaust the C stack if the stack limit is very large (e.g. on DragonFly BSD or with ulimit -s unlimited).

  • gh-154167: The test runner (regrtest) now restores the default SIGINT handler if it was inherited as ignored, so the test suite no longer hangs when run as a shell background job.

  • gh-154144: Fix building the _testcapi module on NetBSD.

  • gh-152548: Add the test.support.isolation.runInSubprocess() decorator to run a test method or TestCase subclass in a fresh interpreter subprocess, isolated from the rest of the test run.

Build

  • gh-154070: Build the curses module against a wide-character capable ncurses even when it is not named ncursesw – for example the pkgsrc ncurses on NetBSD and illumos, or the system ncurses on macOS. Such a library previously produced a narrow build.

  • gh-138800: Fix library name in python3.pc on Android.

Windows

  • gh-124111: Updated Windows builds to use Tcl/Tk 9.0.4.

Tools/Demos

  • gh-154580: Fix python-gdb.py raising UnicodeEncodeError when pretty-printing a non-ASCII str in a locale whose host charset cannot encode it, such as any non-ASCII string in the C locale.

  • gh-152384: The CPython Pixi packages are now all accessible at the same Tools/pixi-packages subdirectory, rather than at Tools/pixi-packages/{variant} as before. Variants are now selected not via subdirectory but via flags; see https://pixi.prefix.dev/latest/concepts/package_specifications/#extras-and-flags for usage instructions. The tsan-freethreading variant has been renamed to tsan_freethreading, while the default, asan, and freethreading variants retain their previous names.

C API

  • gh-122931: Allow importing stable ABI C extensions that include a multiarch tuple in their filename, e.g. foo.abi3-x86-64-linux-gnu.so.

Python 3.15.0 beta 4

Release date: 2026-07-18

Security

  • gh-153030: Fixed quadratic complexity in incremental parsing of long unterminated constructs (such as tags or comments) in html.parser.HTMLParser, which could be exploited for a denial of service.

  • gh-152216: Update bundled libexpat to version 2.8.2.

  • gh-151987: The tarfile.TarFile.extract() method now applies the given filter when it extracts a link target from the archive as a fallback.

  • gh-151981: In tarfile, seeking a stream now stops when end of the stream is reached.

  • gh-151558: Fixed an vulnerability in the tarfile data and tar extraction filters where crafted archives could create a symlink pointing outside the destination directory. This was a bypass of CVE 2025-4330.

  • gh-150743: http.client now limits the number of chunked-response trailer lines it will read to max_response_headers (100 by default), and the number of interim (1xx) responses it will skip to 100. A malicious or broken server could previously stream trailer lines or 100 Continue responses forever, hanging the client even when a socket timeout was in use. Reported by @YLChen-007 via GHSA-w4q2-g22w-6fr4.

  • gh-143927: Normalize all line endings (CR, CRLF, and LF) to LF+TAB when writing multi-line configparser values.

Core and Builtins

  • gh-153298: Fixes a data race in types.GenericAlias __parameters__ initialization on free-threading builds.

  • gh-153205: Fix a potential SystemError during vector calls when memory allocation fails. A MemoryError is now raised instead.

  • gh-152682: Fix NULL pointer dereference in compile() when a reserved name (e.g. __classdict__) is used as a type parameter name and memory allocation fails while formatting the error message.

  • gh-152635: Fix a crash caused when running out of memory creating a _interpchannels channel. Now a MemoryError is correctly raised.

  • gh-152405: Do not expose the internal mapping of types.MappingProxyType when performing rich-compare operations with non-stdlib types. Previously, it was possible to mutate the internal mapping of a proxy there. Now we pass not the original dict instance, but its copy, when dealing with custom types.

  • gh-152492: collections.OrderedDict update method can now accept frozendict as an argument.

  • gh-152375: Fix undefined behaviour when a sys.monitoring callback raised an exception while the program was following a branch or loop.

  • gh-152235: Defer GC tracking of set.intersection(), set.difference(), set.symmetric_difference(), set.union() and set.__sub__. Patch by Donghee Na.

  • gh-152235: Defer GC tracking of a set or frozenset to the end of its construction from iterable. Patch by Donghee Na.

  • gh-152228: Fix an assertion failure when python is built in a debug mode that happened in str.replace() under a limited memory situation.

  • gh-151722: frozendict.fromkeys() now only tracks the frozendict in the garbage collector once the dictionary is fully initialized. Patch by Donghee Na and Victor Stinner.

  • gh-151763: Fixes possible crash on types.CodeType deallocation.

  • gh-152020: On the free-threaded build, asyncio.all_tasks() no longer loses eager-started tasks when called from a thread other than the one running the event loop.

  • gh-151763: Fix a potential crash in compile(), exec(), eval() and ast.parse() when an allocation fails: the parser or compiler could return without setting an exception.

  • gh-151912: Fixed a crash in type() when selecting a metaclass whose tp_new slot is NULL. Such metaclasses are now rejected with TypeError instead of causing a NULL pointer dereference.

  • gh-151773: Fix a crash in contextvars.ContextVar.set() when memory allocation fails.

  • gh-151672: Fix an inconsistency where calling __lazy_import__ with a string fromlist would return a types.LazyImportType that resolves to the named member, rather than the module being imported.

  • gh-151619: Fix an issue where using non-module global or builtin namespaces (such as dictionaries passed to exec()) could cause cached global loads to produce unresolved lazy imports.

  • gh-151126: Fix a crash when sharing memoryview objects between interpreters fails due to running out of memory. It now raises a proper MemoryError.

  • gh-151644: Fix a data race in sys.setdlopenflags() and sys.getdlopenflags() when called concurrently in the free-threaded build. The underlying _PyImport_GetDLOpenFlags and _PyImport_SetDLOpenFlags functions now use atomic load/store operations.

  • gh-151126: Avoid possible crash in _winapi.c where a device has no memory left. Now it properly raises a MemoryError. Patch by Ivy Xu.

  • gh-151029: On Linux, fix sys.remote_exec() unable to find remote writable memory when libpython replaced on disk.

  • gh-150459: Fix SyntaxError error message for from x lazy import y. Raise SyntaxWarning on from . lazy import x (with whitespace between the dots and a module named lazy).

  • gh-150858: Fix a data race while changing __qualname__ of a type concurrently on free-threaded builds.

  • gh-144774: Fix data race in BaseException when an exception is copied while being mutated.

  • gh-150411: Fix a data race in the free-threaded build when gc.get_count() reads the young generation allocation count while another thread updates it.

  • gh-149689: Fix missing error propagation in parser action helpers when memory allocation fails. Patch by Thomas Kowalski.

  • gh-149162: Fix a potential deadlock in PyUnicode_InternFromString() and other interning functions in the free-threaded build when called from C++ static local initializers.

  • gh-148825: Fix build error if specialization is disabled.

Library

  • gh-153695: Hashing a sqlite3.Row that contains an unhashable value now raises TypeError instead of SystemError. Patch by tonghuaroot.

  • gh-153658: Fix sqlite3.Connection.iterdump() raising sqlite3.OperationalError when a table name contains a single quote. Patch by tonghuaroot.

  • gh-85943: Fix struct functions raising BytesWarning under the -bb command line option when a str format is used after an equal bytes format (or vice versa). The internal format cache no longer mixes str and bytes keys.

  • gh-151292: Store the sample count in profiling.sampling binary format, as a 64-bit integer, widening from previously used 32-bit integer. This breaks the existing recordings. Long or thread-heavy profiling sessions will no longer fail because of OverflowError. Patch by Maurycy Pawłowski-Wieroński.

  • gh-153417: Error messages from imaplib.IMAP4.select() and imaplib.IMAP4.uid() no longer raise BytesWarning under -bb when the mailbox or command argument is bytes.

  • gh-153406: email.utils.parsedate_to_datetime() now raises ValueError instead of OverflowError when the parsed year or timezone offset is out of range, matching its documented behavior.

  • gh-153333: The readprofile method of tkinter.Tk now reads the user’s profile scripts using the encoding declared in the file, instead of the locale encoding.

  • gh-153083: Defer GC tracking of an array.array to the end of its construction. Patch by Donghee Na.

  • gh-153292: Fix data race in repr of threading.RLock in free-threading build.

  • gh-153293: Fix the live sampling profiler TUI keeping stale aggregated opcode statistics after a stats reset.

  • gh-143990: A tkinter.font.Font created from a named font, including by copy(), now copies its configured options rather than the options resolved by Tcl’s font actual, preserving a size specified in pixels (a negative size).

  • gh-148286: Fix undefined behavior in compression.zstd.ZstdDecompressor.unused_data when a complete frame was decompressed in a single call.

  • gh-153210: Fix crash on array import under a memory pressure.

  • gh-153200: Fix math.isqrt() returning an incorrect result for arguments not less than 2**64 that are instances of an int subclass with an overridden comparison operator.

  • gh-153068: Fix cProfile.Profile.enable() to no longer overwrite errors from sys.monitoring.

  • gh-153062: Fix a crash when concurrently iterating an itertools.tee() iterator on the free-threaded build.

  • gh-153056: Fix string.Template raising a spurious ValueError when the pattern attribute is a compiled regular expression object, which the documentation allows. On the free-threaded build this also occurred as a data race on the first concurrent use.

  • gh-143921: Narrow the control character check in imaplib commands: only NUL, CR and LF are now rejected. Other control characters are valid in quoted strings and can occur in mailbox names returned by the server, so they are now accepted and sent quoted.

  • gh-153037: Fix ZstdFile raising AttributeError instead of io.UnsupportedOperation when iterating over a file that is not open for reading.

  • gh-135661: Fix html.parser.HTMLParser: an abruptly closed empty comment (<!--> or <!--->) no longer extends up to a later --> in the same feed() call.

  • gh-152851: Prevent a crash when allocation fails while copying a BLAKE-2s/2b object. Patch by Bénédikt Tran.

  • gh-54930: Error responses of http.server.BaseHTTPRequestHandler to malformed request lines now include a status line and headers instead of being sent in the bare HTTP/0.9 style. Only a valid HTTP/0.9 request (a two-word GET request line) now receives an HTTP/0.9 style response.

  • gh-119592: Fix concurrent.futures.ProcessPoolExecutor stranding submitted work forever when a worker process exited upon reaching its max_tasks_per_child limit after shutdown() was called with wait=False: a replacement worker is now spawned and the remaining work executed as documented. If the executor has instead been garbage collected without shutdown() (gh-152967), or a replacement worker cannot be started, the remaining futures now fail with BrokenProcessPool instead of never resolving. A worker exit racing shutdown(wait=False) can also no longer crash the executor management thread.

  • gh-150579: concurrent.futures now uses lazy imports for its executor submodules instead of a module __getattr__ hook.

  • gh-152951: collections.deque prevent rare crash when calling extend under high memory pressure conditions.

  • gh-150880: Normalize non-extended Windows paths before appending the wildcard used by os.listdir() and os.scandir(), making paths with trailing spaces behave consistently with other filesystem APIs.

  • gh-152068: Fixes a bug when a line was split (particularly on macOS Terminal.app) in the middle of a colorized keyword, causing the ANSI Color Reset sequence (ESC0m) to not be properly printed, causing the output to be colored when it shouldn’t

  • gh-152849: Out-of-range float and integer timestamps now raise OverflowError with the same message. Patch by tonghuaroot.

  • gh-152847: Reject a POSIX TZ transition rule with non-digit characters in the day-of-year field in the pure-Python zoneinfo parser. Patch by tonghuaroot.

  • gh-152718: Fix unbounded memory allocation in the profiling.sampling binary profile reader when a file declares more string or frame entries than it contains.

  • gh-108280: Connecting imaplib to a server that does not send a valid IMAP4 greeting (for example a POP3 server answering on the IMAP port) now raises an error reporting the server’s response instead of imaplib.IMAP4.error: None.

  • gh-63121: imaplib now refreshes the cached capability list after a successful login() or authenticate(), using the CAPABILITY response sent by the server or, if none was sent, by querying it, so that capabilities that become available only after authentication (such as ENABLE on Gmail) are recognized. Capabilities advertised in the server greeting are now also used, avoiding a redundant CAPABILITY command.

  • gh-88574: imaplib no longer fails when a server sends a spurious blank line after the counted data of a literal, including after a literal that terminates a response (such as a mailbox name returned by LIST). Such blank lines are now skipped without swallowing the following line.

  • gh-152502: Detect the curses mouse interface (getmouse(), the BUTTON* constants, and others) with a configure capability probe or library macros instead of gating it on ncurses-specific macros. It is now also available with other curses implementations that provide it, such as NetBSD curses and PDCurses (the latter underpins windows-curses).

  • gh-151842: Fix a crash in _interpreters.capture_exception() when MemoryError happens. Patch by Amrutha Modela.

  • gh-40038: imaplib now again quotes command arguments when necessary, for example mailbox names containing a space. Such quoting was inadvertently disabled when the module was ported to Python 3, and the arguments are now quoted according to the RFC 3501 grammar. For backward compatibility, an argument already enclosed in double quotes is left unchanged, so code that quotes arguments itself keeps working.

  • gh-50966: Fix unbounded recursion in turtle when a mouse event handler that moves the turtle is reentered while the screen is being redrawn, for example with screen.ondrag(turtle.goto). This could previously crash the interpreter.

  • gh-152569: Fix asyncio.wait() leaking waiting tasks via the await-graph when racing a future that never resolves. The waiting task is now discarded from every future’s awaited_by set once wait() returns, even for pending futures.

  • gh-110357: Importing hashlib no longer logs an error to stderr when a normally guaranteed hash algorithm is unavailable in the current runtime (for example under an OpenSSL FIPS configuration or a build using --without-builtin-hashlib-hashes). Code that actually uses the missing algorithm still gets a clear ValueError.

  • gh-152356: Fix a hang in profiling.sampling run --blocking on Windows when the target process exits. The profiler now finalizes binary profiles instead of continuing to sample the exited process.

  • gh-78335: Update the docstrings of tkinter and tkinter.ttk widget classes to list all supported widget options, including options added in Tk 9.0 and 9.1. tkinter.Menubutton and tkinter.Message previously had no option list at all.

  • gh-151126: Fix two crashes in tkinter and socket modules initialization under a memory pressure. Sets missing MemoryError.

  • gh-133031: curses.textpad.Textbox now enters and reads back the non-ASCII characters of an 8-bit locale encoding, instead of mangling them with a 7-bit mask.

  • gh-71880: curses.textpad.Textbox now lets the lower-right cell of the window be edited. Writing it with addch() would move the cursor past the end of the window, raising an error and scrolling a scrollable window, so it is now written with insch(), which keeps the cursor in place.

  • gh-83274: Deallocating a tkinter application from a thread other than the one it was created in no longer crashes the interpreter. The underlying Tcl interpreter is leaked instead, and a RuntimeWarning is reported.

  • gh-152305: Fix the pure-Python datetime.time.strftime() implementation raising AttributeError for the year directives. Patch by tonghuaroot.

  • gh-88758: tkinter.Misc.focus_get(), focus_displayof(), focus_lastfor() and winfo_containing() now return None instead of raising KeyError when the widget was not created by tkinter (for example a torn-off menu).

  • gh-38464: tkinter.Misc.nametowidget() now resolves the auto-generated names of cloned menus (a menu used as a menubar or a cascade) back to the original widget.

  • gh-152248: Make the C and pure-Python zoneinfo parsers validate POSIX TZ abbreviations consistently, rejecting unquoted abbreviations with non-letter characters and empty quoted abbreviations. Patch by tonghuaroot.

  • gh-80937: Fix a memory leak in tkinter when a Tcl command created with createcommand was not explicitly removed before the interpreter was deleted. The command no longer keeps the interpreter alive through a reference cycle.

  • gh-152246: Fix the pure-Python zoneinfo parser accepting an invalid POSIX TZ transition rule with a non-period separator. Patch by tonghuaroot.

  • gh-151496: Fixed profiling.sampling --gecko with --async-aware by flattening async task stacks before generating Gecko samples. --binary now rejects --async-aware until the binary format supports async task data.

  • gh-139816: Fix a hang in tkinter on interactive Python built without readline. An exception raised in a callback no longer causes the event loop to stop and wait for the user to press Enter; pending callbacks now keep running until input is actually available on stdin.

  • gh-139145: Fix a busy loop in tkinter on interactive Python. When a Tcl command running its own event loop (such as vwait or wait_variable()) was active and input arrived on stdin, the event loop kept spinning at 100% CPU. The stdin file handler is now removed as soon as input is available. Based on a patch by Michiel de Hoon.

  • gh-152212: Fix the pure-Python zoneinfo parser accepting a POSIX TZ string with a std abbreviation but no offset. This is invalid per POSIX and now raises ValueError, matching the C accelerator. Patch by tonghuaroot.

  • gh-152156: Fix a possible crash in concurrent.interpreters.create() under limited memory conditions.

  • gh-152157: The C implementations of fromisoformat() and fromisoformat() now reject a decimal separator that is not followed by any fractional digit before a timezone designator.

  • gh-151763: Fix crash in _interpqueues.create() whe MemoryError happens on queue creation.

  • gh-151669: On Windows, when populating tar archives from filesystem content, to conform to the tar format standard, backslashes in symlink targets are be replaced by slashes.

  • gh-105895: Add match and case to the list of supported topics by help().

  • gh-151378: Fix a bug in the binary collector in Tachyon that caused unbounded memory growth while profiling a thread that stayed asleep. Patch by Maurycy Pawłowski-Wieroński.

  • gh-152079: Fix datetime.datetime.fromisoformat() in the C implementation dropping the sub-second part of a UTC offset whose whole-second part is zero, matching the pure-Python implementation.

  • gh-152052: The json C accelerator now correctly reports an unterminated string for a \uXXXX escape at the end of the input.

  • gh-152060: Fix datetime.datetime.fromisoformat() raising AssertionError instead of ValueError for some malformed strings in the pure-Python implementation, matching the C implementation.

  • gh-127802: The deprecated tkinter.Variable methods trace_variable(), trace(), trace_vdelete() and trace_vinfo() are now scheduled for removal in Python 3.17.

  • gh-126219: Fixed a crash in tkinter.Tk when className contains a non-BMP character and tkinter is built against Tcl/Tk 8.x. Such a name is now rejected with a ValueError.

  • gh-86165: Fix imaplib.Time2Internaldate() to use the local timezone offset for time.struct_time values with tm_gmtoff set to None, as returned by datetime.datetime.timetuple(). Contributed by Xiao Yuan.

  • gh-151814: Fix unbounded memory growth in io.TextIOWrapper when repeatedly writing an empty string.

  • gh-151596: Add missing size positional argument to the pure-Python implementation of io.TextIOBase.readline().

  • gh-151640: Fix a data race in io.BytesIO in free-threaded builds when whole-buffer reads or peeks, or getvalue(), share the internal buffer with concurrent writes.

  • gh-151613: Fix another way the Tachyon profiler frame cache could produce impossible mixed stack traces when _PyInterpreterFrame addresses are reused, by validating cached frame anchors with a sequence counter.

  • gh-148660: Fix a crash in collections.OrderedDict.copy() when a key’s __eq__ or a subclass method mutates the dict during the copy. Now raises RuntimeError instead, as iteration does.

  • gh-151497: Opening a tarfile archive no longer attempts to pre-allocate a huge buffer when a crafted or truncated member claims an oversized extended header (a GNU long name/link or a pax header). The extended header is now read in bounded chunks, so its size field can no longer trigger memory exhaustion.

  • gh-151416: Fix a crash in os.spawnv() and os.spawnve() when an argv item’s __fspath__() method mutates the argv list during argument conversion. os.spawnv() argument conversion errors other than TypeError, such as the ValueError for an embedded null, are no longer replaced with a generic TypeError.

  • gh-150994: Make type annotations in the private _colorize module resolvable.

  • gh-150994: Make the type annotations in the private _colorize module resolvable.

  • gh-150583: Correctly set the default compression level in compression.zstd when passing a digested dictionary during compression.

  • gh-150641: Fix bug where typing.evaluate_forward_ref() with the STRING format could leak internal names used by the annotation machinery.

  • gh-149816: Fix a potential use after free condition in pickle.dumps() in free-threaded mode when serializing lists.

  • gh-47005: Fix urllib.request.AbstractHTTPHandler.do_open() to give regular headers set via add_header() priority over unredirected headers, consistent with get_header() and header_items().

  • gh-140729: Fix a pickling error in the cProfile module when profiling a script that uses multiprocessing.Process with the spawn and forkserver start methods.

  • gh-115634: Fix a deadlock in concurrent.futures.ProcessPoolExecutor when using max_tasks_per_child, present since the feature was introduced in Python 3.11. The executor stopped scheduling queued tasks after a worker process exited upon reaching its task limit. Based on a fix proposed by Tabrez Mohammed.

  • gh-79638: Disallow all access in urllib.robotparser if the robots.txt file is unreachable due to server or network errors.

  • gh-105708: Accept an uppercase V prefix in IPvFuture addresses in urllib.parse.urlsplit().

Tests

  • gh-151626: Fix several tests in test.test_inspect, test.test_import, test.test_importlib, test.test_py_compile and test.test_compileall that failed when the test suite was run with PYTHONPYCACHEPREFIX set. These tests now neutralize the pycache prefix where they assume the default __pycache__ bytecode layout.

  • gh-151096: Fix test_embed failing when CPython is configured with a split exec prefix (--exec-prefix differing from --prefix).

Build

  • gh-126877: Fix the configure check for Tcl/Tk which could wrongly succeed with optimizing compilers when the libraries are missing.

  • gh-153438: Update Windows build and installer tooling and documentation to use the current download URL for nuget.exe.

  • gh-152870: Fix a compilation error in the decimal C extension (_decimal) when it is built with EXTRA_FUNCTIONALITY. Context.apply() called the internal _apply helper using its pre-Argument-Clinic signature; the call is now made through the generated _impl function.

  • gh-152769: Enable the perf profiler trampoline on Alpine Linux with the musl C library on x86_64 and aarch64. The trampoline is architecture-specific and does not depend on the C library, so the same assembly trampoline used for glibc is reused for musl.

  • gh-152502: The curses module now detects set_escdelay(), set_tabsize() and the ESCDELAY and TABSIZE variables with configure capability probes instead of the ncurses-specific NCURSES_EXT_FUNCS macro, so they are exposed when building against other curses implementations such as NetBSD curses that provide them.

Windows

  • gh-140146: Prevent tkinter from hanging on Windows if stdin is redirected to a pipe in an interactive session. This is helpful for testing interactive usage of tkinter from a script, for example as part of the cpython test suite.

macOS

  • gh-124111: Update macOS installer to use Tcl/Tk 9.0.4.

  • gh-152023: Update macOS installer builds to SQLite 3.53.3. Enable median() and percentile() functions.

IDLE

  • gh-82183: When the shell is busy running code, using “Run… Customized” with “Restart shell” unchecked now reports that the shell is executing instead of restarting it anyway.

  • gh-83653: Blanking an integer entry in IDLE’s Settings dialog, such as “Auto squeeze min lines”, no longer saves an empty string as an invalid configuration value.

  • gh-65339: Saving the IDLE Shell or an Output window now defaults to a .txt extension and lists text files before Python files, since their content is not Python source.

  • gh-80504: The “In files:” field of IDLE’s Find in Files dialog now always contains a full directory path, even for an unsaved editor or the Shell. This shows in the grep output which directory was searched.

  • gh-134300: Do not add the idlelib directory to the path of the IDLE user process. User code run in IDLE can no longer import idlelib submodules as top-level modules, such as import help.

  • gh-89360: Fix a rare crash in the IDLE editor when the completion window is closed: deleting a key binding for a sequence that is not bound to the virtual event is now ignored instead of raising a ValueError.

  • gh-71956: Fix Replace All in the IDLE editor’s Replace dialog when the search direction is “Up” and “Wrap around” is off: it now replaces all matches above the current position instead of only the first one.

  • gh-152728: Move functions run.fix_scaling, editor.fixwordbreaks (as fix_word_breaks) and pyshell.fix_x11_paste to idlelib.util.

  • gh-66331: Set the WM_CLASS window property of IDLE’s windows to Idle on X11, so that window managers group and label them correctly instead of using the default Toplevel.

  • gh-85320: IDLE now reads and writes its configuration files and the breakpoints file using UTF-8 instead of the locale encoding. This keeps non-ASCII data (such as non-ASCII paths) from being corrupted and makes the files portable between environments.

C API

Python 3.15.0 beta 3

Release date: 2026-06-23

Security

  • gh-151544: Modules/Setup.local is no longer used as a landmark to discover whether Python is running in a source tree, as it could potentially affect actual installs. The pybuilddir.txt file is now the sole indicator of running in a source tree.

  • gh-151159: Update macOS installer to use OpenSSL 3.5.7.

  • gh-151159: Update Android and iOS installers to use OpenSSL 3.5.7.

  • gh-150599: Fix a possible stack buffer overflow in bz2 when a bz2.BZ2Decompressor is reused after a decompression error. The decompressor now becomes unusable after libbz2 reports an error.

  • gh-149835: shutil.move() now resolves symlinks via os.path.realpath() when checking whether the destination is inside the source directory, preventing a symlink-based bypass of that guard.

Core and Builtins

  • gh-151905: Fix OOM error handling in PyFrame_GetBack() to propagate exceptions instead of masking them as None.

  • gh-151722: Defer GC tracking of frozendict to end of construction. Patch by Donghee Na.

  • gh-151546: Fix the stack limit check if Python is linked to musl (ex: Alpine Linux). Use the stack size set by the linker to compute the stack limits. Patch by Victor Stinner.

  • gh-151510: Fix a crash in __lazy_import__() when called without an explicit globals argument and without a current Python frame.

  • gh-151461: Fix direct execution of files with invalid source encodings to report the underlying codec lookup or decoding error instead of the generic SyntaxError: encoding problem message. Patch by Bartosz Sławecki.

  • gh-151218: PyConfig_Set() and sys.set_int_max_str_digits() now replace sys.flags (create a new object), instead of modifying sys.flags in-place. Patch by Victor Stinner.

  • gh-151297: Fix an invalid pointer dereference that could occur when calling PyObject_Realloc() with a NULL pointer in free-threaded builds or with PYTHONMALLOC set to mimalloc.

  • gh-151253: If import encodings (first import) fails at Python startup, dump the Python path configuration to help users debugging their configuration. Patch by Victor Stinner.

  • gh-151238: Fix a crash when compiling a concatenated f-string or t-string if an error occurs when processing one of it’s parts.

  • gh-151112: Fix a crash in the compiler that could occur when running out of memory.

  • gh-151126: Fix a crash, when there’s no memory left on a device, which happened in: code compilation, _interpchannels module, _winapi.CreateProcess() function.

    Now these places raise proper MemoryError errors.

  • gh-150902: Apply an existing optimization of PyCriticalSection (single mutex) to PyCriticalSection2: avoid acquiring the same locks that the current CS has already acquired.

  • gh-151065: Fix memory leak when using the mimalloc memory allocator.

  • gh-150988: Fix a reference leak in OSError when attributes are set before super().__init__().

  • gh-150723: Fix perf jitdump timestamps on macOS. Events were stamped using CLOCK_MONOTONIC, but macOS profilers timestamp their samples with mach_absolute_time(). The mismatch prevented the JIT code mappings from lining up with the samples, so no Python frame could be resolved.

  • gh-150723: Fix malformed perf jitdump thread ids on macOS. The thread_id field of the JR_CODE_LOAD record was written as a 64-bit value instead of the 32-bit value required by the jitdump format, which shifted every following field and prevented profilers from resolving Python frames.

  • gh-150700: Fix a SystemError when compiling a class-scope comprehension containing a lambda that references __class__, __classdict__, or __conditional_annotations__. Patch by Bartosz Sławecki.

  • gh-150633: Fix the frozen importer accepting module names with embedded null bytes, which caused it to bypass the sys.modules cache and create duplicate module objects.

  • gh-148613: Fix a data race in the free-threaded build between gc.set_threshold() and garbage collection scheduling during object allocation.

  • gh-150207: Fix a crash when a memory allocation fails during tokenizer initialization. A proper MemoryError is now raised instead.

  • gh-149805: Fix a SystemError when compiling a compiling __classdict__ class annotation. Found by OSS-Fuzz in #512907042.

  • gh-149321: Do not support none as a lazy imports mode.

Library

  • gh-75666: Fix a reference leak in tkinter: the Tcl commands created for event callbacks are now deleted when a binding is replaced or unbound.

  • gh-151770: Fix datetime.datetime.fromisoformat() raising AssertionError instead of ValueError for an out-of-range month combined with a 24:00 time.

  • gh-151665: inspect.signature() now works on the lazy evaluators of type aliases and type parameters instead of raising ValueError.

  • gh-151695: Fix a use-after-free in the curses module. The encoding of the initial screen, used by curses.unctrl() and curses.ungetch() to encode non-ASCII characters, is now kept as a private copy instead of a borrowed pointer to a window object that may be deallocated.

  • gh-151436: Fix skewed stack trackes in the Tachyon profiler when caching is enabled and when generators and coroutines are profiled, by updating tstate->last_profiled_frame at every frame-removal site. The issue resulted in total erasure of some callers. Patch by Maurycy Pawłowski-Wieroński.

  • gh-151426: Fix impossible stack traces (callers and callees cross called, orphans and incorrect lines) in the Tachyon profiler when caching frames, by snapshotting the stack chunks before walking the frame chain on a cache miss. Patch by Maurycy Pawłowski-Wieroński.

  • gh-151403: Fixed a crash in subprocess.Popen (and _posixsubprocess.fork_exec) when an argv item’s __fspath__() concurrently mutates the args sequence being converted.

  • gh-151390: Colorize match in the REPL when followed by a unary + or - operator. Patch by Bartosz Sławecki.

  • gh-151126: Fix crash on unset MemoryError on allocation failure in ctypes.get_errno().

  • gh-151337: Avoid possible memory leak in tkinter.c on Windows.

  • gh-151126: Fix a crash when MemoryError in os._path_splitroot() was not set properly.

  • gh-149671: Restore compatibility with setuptools -nspkg.pth files in the site module. Inject sitedir variable in the frame which executes pth code. Patch by Victor Stinner.

  • gh-151295: Fixed a crash (use-after-free) in bytes.join() and bytearray.join() that could occur if an item’s __buffer__() concurrently mutates the sequence being joined. The mutation is now reported as a RuntimeError instead.

  • gh-109940: Fix Windows venv activation in cmd.exe to respect VIRTUAL_ENV_DISABLE_PROMPT.

  • gh-150771: Fix email messages created with shift_jis or euc-jp charsets. set_content() now stores the payload using the output charset (iso-2022-jp) so printing the message no longer raises UnicodeEncodeError.

  • gh-151039: Fix a crash when static datetime types outlive the _datetime module.

  • gh-151021: Fix mmap.mmap.find() and rfind() to return -1 when searching for an empty subsequence with a start position past the end of the mapping.

  • gh-62825: Encodings “KS_C_5601-1987”, “KS X 1001”, etc are now aliases of “CP949” instead of “EUC-KR”.

  • gh-150913: Fix sqlite3.Blob slice assignment to raise TypeError and IndexError for type and size mismatches respectively, even when the target slice is empty.

  • gh-143008: Fix race conditions when re-initializing a io.TextIOWrapper object.

  • gh-150662: Fix the --gecko collector in profiling.sampling that kept every sample in memory. It now writes sample and marker data to temporary files and reads them back, ultimately building the output file at the end. Patch by Pablo Galindo and Maurycy Pawłowski-Wieroński.

  • gh-150750: Fix a race condition in collections.deque.index() with free-threading.

  • gh-148932: Fix profiling.sampling on Windows virtual environments to resolve the actual Python PID from a virtual environment shim.

  • gh-149816: Fix race condition in ssl.SSLContext.sni_callback

  • gh-53144: The email package now supports all aliases of Python codecs and uses MIME/IANA names for all IANA registered charsets.

  • gh-149891: Add support for more encoding aliases officially registered in IANA.

  • gh-149473: Calling os.environ.clear() now emits os._clearenv auditing event. Patch by Victor Stinner.

  • gh-148954: Fix XML injection vulnerability in xmlrpc.client.dumps() where the methodname was not being escaped before interpolation into the XML body.

  • gh-143988: Fixed crashes in socket.socket.sendmsg() and socket.socket.recvmsg_into() that could occur if buffer sequences are concurrently mutated.

  • gh-120665: Fixed an issue where unittest loaders would load and instantiate unittest.TestCase-derived subclasses that are also abstract base classes, which can’t be instantiated.

  • gh-91099: imaplib.IMAP4.login() now raises exceptions with str instead of bytes. Patch by Florian Best.

  • gh-101267: When a worker process terminates unexpectedly, concurrent.futures.ProcessPoolExecutor now sets a separate BrokenProcessPool exception on each pending future instead of sharing a single instance among them all. Sharing one exception produced malformed tracebacks: each Future.result() call re-raised the same object, appending another copy of the traceback to it.

Documentation

  • gh-86726: Greatly expand the tkinter documentation to cover the full public API of the package and its submodules. The descriptions are oriented towards Python rather than Tcl/Tk, with corrected return types and versionadded/versionchanged information.

  • gh-150319: Generic builtin and standard library types now document the meaning of their type parameters.

  • gh-109503: Fix documentation for shutil.move() on usage of os.rename() since nonatomic move might be used even if the files are on the same filesystem. Patch by Fang Li

Tests

  • gh-151130: Add more tests for PyWeakref_* C API.

  • gh-150966: Avoid prematurely terminating failing live sampling profiler test targets, which made stderr assertions flaky on ASAN buildbots.

  • gh-148853: Fix tests failing on FreeBSD in test.support’s in_systemd_nspawn_sync_suppressed() due to unreadable /run directory.

Build

  • gh-151163: Updated Android build to include SQLite version 3.53.2.

Windows

  • gh-151163: Updated Windows builds to include SQLite version 3.53.2.

  • gh-151159: Updated bundled version of OpenSSL to 3.5.7.

  • gh-150836: Make installed tkinter work with Tcl/Tk 9 builds that embed the Tk script library in the Tk DLL on Windows.

macOS

  • gh-151163: Updated macOS installer to include SQLite version 3.53.2.

IDLE

  • bpo-6699: Warn the user if a file will be overwritten when saving.

C API

Python 3.15.0 beta 2

Release date: 2026-06-02

Security

  • gh-149698: Update bundled libexpat to version 2.8.1 for the fix for CVE 2026-45186.

  • gh-87451: The ftplib module’s undocumented ftpcp function no longer trusts the IPv4 address value returned from the source server in response to the PASV command by default, completing the fix for CVE-2021-4189. As with ftplib.FTP, the former behavior can be re-enabled by setting the trust_server_pasv_ipv4_address attribute on the source ftplib.FTP instance to True. Thanks to Qi Deng at Aurascape AI for the report.

  • gh-149474: Fix the binary writer in profiling.sampling not firing the audit (PEP 578) when creating the output file. The writer and the reader now accept any path-like object. Patch by Maurycy Pawłowski-Wieroński.

  • gh-149486: tarfile.data_filter() now validates link targets using the same normalised value that is written to disk, strips trailing separators from the member name when resolving a symlink’s directory, and rejects link members that would replace the destination directory itself. This closes several path-traversal bypasses of the data extraction filter.

  • gh-149079: Fix a potential denial of service in unicodedata.normalize(). The canonical ordering step of Unicode normalization used a quadratic-time insertion sort for reordering combining characters, which could be exploited with crafted input containing many combining characters in non-canonical order. Replaced with a linear-time counting sort for long runs.

  • gh-149018: Improved protection against XML hash-flooding attacks in xml.parsers.expat and xml.etree.ElementTree when Python is compiled with libExpat 2.8.0 or later.

Core and Builtins

  • gh-150374: Fix double release of the import lock on lazy import reification errors.

  • gh-149156: Fix an intermittent crash after os.fork() when perf trampoline profiling is enabled and the child returns through trampoline frames inherited from the parent process.

  • gh-149449: Fix a use-after-free crash when the unicodedata module was removed from sys.modules and garbage-collected between calls that decode \N{...} escapes or use the namereplace codec error handler.

  • gh-150107: asyncio: sendfile() and sock_sendfile() event loop methods now call file.seek(offset) if file has a seek() method, even if offset is 0 (default value).

  • gh-150146: Fix a crash on a complex type variable substitution.

    from typing import TypeVar; memoryview[TypeVar("")][*typing.Mapping[..., ...]] used to fail due to missing NULL check on _unpack_args C function call.

  • gh-148587: sys.lazy_modules is now a set instead of a dict as initially spelled out in PEP 810.

  • gh-150042: Fix refleak in queue.SimpleQueue.put if memory allocation fails.

  • gh-149590: Fix crash when faulthandler is imported more than once.

  • gh-149816: Fix a race condition in _PyBytes_FromList in free-threading mode.

  • gh-149816: Fix a race condition in memoryview with free-threading.

  • gh-149807: Fix hash(frozendict): compute the hash of each (key, value) pair correctly. Patch by Victor Stinner.

  • gh-149738: sqlite3: Disallow removing row_factory and text_factory attributes of a connection to prevent a crash on a query.

  • gh-139808: Add branch protections for AArch64 (BTI/PAC) in assembly code used by -X perf_jit (Linux perf profiler integration).

  • gh-149676: Fix frozendict | frozendict hash.

  • gh-148829: sentinel objects now support a repr= argument and their __module__ attribute is writable.

  • gh-149642: Allow imports inside exec() calls within functions under PYTHON_LAZY_IMPORTS=all.

  • gh-144957: Fix lazy from imports of module attributes provided by module-level __getattr__.

  • gh-149459: Fix a crash in the JIT optimizer when a specialized LOAD_SPECIAL guard deoptimized after inserting the synthetic NULL stack entry.

  • gh-148450: Fix abc.register() so it invalidates type version tags for registered classes.

Library

  • gh-150685: Update bundled pip to 26.1.2

  • gh-150228: The new site.StartupState class lets callers batch-process PEP 829 startup configuration files across multiple site directories before any startup code runs, with public addsitedir(), addusersitepackages(), addsitepackages(), and process() methods. The signature of site.addsitedir() is unchanged from Python 3.14. The defer_processing_start_files argument and the process_startup_files() function added earlier in the 3.15 cycle have been removed; use site.StartupState instead.

  • gh-150406: Fix a possible crash occurring during socket module initialization when the system is out of memory on platforms without a reentrant gethostbyname.

  • gh-150372: readline: Fix a potential crash during tab completion caused by an out-of-memory error during module initialization.

  • gh-150157: Fix a crash in free-threaded builds that occurs when pickling by name objects without a __module__ attribute while sys.modules is concurrently being modified.

  • gh-150175: Fix race condition in unittest.mock.ThreadingMock where concurrent calls could lose increments to call_count and other attributes due to a missing lock in _increment_mock_call.

  • gh-84353: Preserve non-UTF-8 encoded filenames when appending to a zipfile.ZipFile. Previously, non-ASCII names stored in a legacy encoding (without the UTF-8 flag bit set) could be corrupted when the central directory was rewritten: they were decoded as cp437 and then re-stored as UTF-8.

  • gh-149189: Revert the changes to pprint defaults. Patch by Hugo van Kemenade.

  • gh-149995: Update various docstrings in typing.

  • gh-88726: The email package now uses standard MIME charset names “gb2312” and “big5” instead of non-standard names “eucgb2312_cn” and “big5_tw”.

  • gh-149571: Fix the C implementation of xml.etree.ElementTree.Element.itertext(): it no longer emits text for comments and processing instructions.

  • gh-149921: Fix reference leaks in error paths of the _interpchannels and _interpqueues extension modules.

  • gh-142349: Add lazy to the list of support topic by help().

  • gh-149819: Fix regression in site.addsitedir() where .pth files were no longer processed in Python subprocesses. This happened because site.main() seeded known_paths with entries inherited from the parent process, causing addsitedir to skip .pth processing.

  • gh-149816: Fix a race condition in _random.Random.__init__ method in free-threading mode.

  • gh-149801: Add IANA registered names and aliases with leading zeros before number (like IBM00858, CP00858, IBM01140, CP01140) for corresponding codecs.

  • gh-149718: Coalesce consecutive identical stack frames in Tachyon, so aggregating collectors (pstats, collapsed, flamegraph, gecko) receive one collect. Improves sample rate 3x, error rate and missed rate drop by 70%. Patch by Maurycy Pawłowski-Wieroński.

  • gh-149701: Fix bad return code from Lib/venv/bin/activate if hashing is disabled

  • gh-149504: Fix site.addsitedir() to allow re-entrant calls from within startup files. Previously, a .pth file containing an import line that called site.addsitedir() (or a .start entry point doing the same) could crash with RuntimeError: dictionary changed size during iteration during site initialization, breaking tools such as uv run --with.

  • gh-149584: Fix excessive overhead in the Tachyon profiler when inspecting a remote process by avoiding repeated remote page-cache scans, batching predicted remote reads, and reusing cached profiler result objects. Patch by Pablo Galindo and Maurycy Pawłowski-Wieroński.

  • gh-139489: Add xml.is_valid_text() to xml.__all__.

  • gh-149614: Fix a regression that broke the ability to deepcopy argparse.ArgumentParser instances.

  • gh-112821: In the REPL, autocompletion might run arbitrary code in the getter of a descriptor. If that getter raised an exception, autocompletion would fail to present any options for the entire object. Autocompletion now works as expected for these objects.

  • gh-149534: Fix merging of collections.defaultdict and frozendict.

  • gh-149388: Make asyncio.windows_utils.PipeHandle closing idempotent.

  • gh-149489: Fix ElementTree serialization to HTML. The content of comments, processing instructions and elements “xmp”, “iframe”, “noembed”, “noframes”, and “plaintext” is no longer escaped. The “plaintext” element no longer have the closing tag. Add support of empty attributes (with value None).

  • gh-149056: Fix json.load() not forwarding the array_hook argument to json.loads(). Patch by Thomas Kowalski.

  • gh-149046: io: Fix io.StringIO serialization: no longer call str(obj) on str subclasses. Patch by Thomas Kowalski.

  • gh-148441: xml.parsers.expat: prevent a crash in CharacterDataHandler() when the character data size exceeds the parser’s buffer size.

  • gh-146452: Fix segfault in pickle when pickling a dictionary concurrently mutated by another thread in the free-threaded build.

  • gh-86533: The os.makedirs() function and pathlib.Path.mkdir() method now have a parent_mode parameter to specify the mode for intermediate directories when creating parent directories. This allows one to match the behavior from Python 3.6 and earlier for os.makedirs().

  • gh-134261: zip: On reproducible builds, ZipFile uses UTC instead of the local time when writing file datetimes to avoid underflows.

  • gh-133998: Fix struct.error exception when creating a file with gzip.GzipFile or compressing data with gzip.compress() if the system time is outside the range 00:00:00 UTC, January 1, 1970 through 06:28:15 UTC, February 7, 2106, or explicitly passed mtime argument is outside the range 0 to 2**32-1.

  • gh-128110: Fix bug in the parsing of email address headers that could result in extraneous spaces in the decoded text when using a modern email policy. Space between pairs of adjacent RFC 2047 encoded-words is now ignored, per section 6.2 (and consistent with existing parsing of unstructured headers like Subject).

  • gh-107398: Fix tarfile stream mode exception when process the file with the gzip extra field.

  • gh-121109: Fix tarfile performance issue when reading archives in streaming mode (e.g. r|*).

  • bpo-45509: Gzip headers are now checked for corrupted NAME, COMMENT and HCRC fields.

Tests

  • gh-150387: Fix hang in test.test_profiling.test_sampling_profiler.test_live_collector_ui.TestLiveModeErrors.test_run_failed_script_live on slow buildbots. The test now always queues a final q keystroke so the live TUI loop exits even when the profiler collects enough samples to enter the post-finished input loop.

  • gh-149776: Fix test_socket on Linux kernel 7.1 and newer: skip UDP Lite tests if it’s not supported. Patch by Victor Stinner.

Build

  • gh-148294: Corrected the use of AC_PATH_TOOL in configure.ac to allow a C++ compiler to be found on PATH.

  • gh-148260: On Linux when Python is linked to the musl C library, use a thread stack size of at least 1 MiB instead of musl default which is 128 kiB. Patch by Victor Stinner.

Windows

  • gh-149786: Fixes virtual environment launchers on Windows free-threaded builds.

  • gh-124111: Updated Windows builds to use Tcl/Tk 9.0.3.

  • gh-138489: Windows distributions now include a build-details.json file (see PEP 739). The legacy installer does not install it, but all other distributions from python.org and all preset configurations in the PC\layout script will include one.

  • gh-149029: Update Windows installer to ship with SQLite 3.53.1.

macOS

  • gh-150644: When system logging is enabled (with config.use_system_logger, messages are now tagged as public. This allows the macOS 26 system logger to view messages without special configuration.

  • gh-149029: Update macOS installer to ship with SQLite version 3.53.1.

Tools/Demos

  • gh-150258: Update the tooltip on the Tachyon flame graph to show both absolute and relative percentages.

C API

Python 3.15.0 beta 1

Release date: 2026-05-07

Security

  • gh-149254: Update Android and iOS installer to use OpenSSL 3.5.6.

  • gh-149017: Update bundled libexpat to version 2.8.0.

  • gh-148252: Fixed string table and sample record bounds checks in _remote_debugging when decoding certain .pyb inputs on 32-bit builds. Patch by Maurycy Pawłowski-Wieroński.

  • gh-90309: Base64-encode values when embedding cookies to JavaScript using the http.cookies.BaseCookie.js_output() method to avoid injection and escaping.

  • gh-148808: Added buffer boundary check when using nbytes parameter with asyncio.AbstractEventLoop.sock_recvfrom_into(). Only relevant for Windows and the asyncio.ProactorEventLoop.

  • gh-148395: Fix a dangling input pointer in lzma.LZMADecompressor, bz2.BZ2Decompressor, and internal zlib._ZlibDecompressor when memory allocation fails with MemoryError, which could let a subsequent decompress() call read or write through a stale pointer to the already-released caller buffer.

  • gh-148252: Fixed stack depth calculation in _remote_debugging when decoding certain .pyb inputs on 32-bit builds. Issue originally identified and diagnosed by Tristan Madani (@TristanInSec on GitHub).

  • gh-148178: Hardened _remote_debugging by validating remote debug offset tables before using them to size memory reads or interpret remote layouts.

  • gh-148169: A bypass in webbrowser allowed URLs prefixed with %action to pass the dash-prefix safety check.

  • gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows which allowed to write files outside of the destination tree if the patch in the archive contains a Windows drive prefix. Now such invalid paths will be skipped. Files containing “..” in the name (like “foo..bar”) are no longer skipped.

  • gh-137586: Fix a PATH-injection vulnerability in webbrowser on macOS where osascript was invoked without an absolute path. The new MacOS class uses /usr/bin/open directly, eliminating the dependency on osascript entirely.

  • gh-146333: Fix quadratic backtracking in configparser.RawConfigParser option parsing regexes (OPTCRE and OPTCRE_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.

Core and Builtins

  • gh-148940: Revert the process size based deferral of garbage collection (gh-133464). The performance issue this change resolves is also fixed by gh-142562. This approach has the problem that process size as seen by the OS (e.g. the resident size or RSS) does not immediately decrease after cyclic garbage is freed since mimalloc defers returning memory of the OS. This change applies to the free-threaded GC only.

  • gh-149243: Check for recursion limits in CALL_ALLOC_AND_ENTER_INIT opcode.

  • gh-126910: Add support for unwinding JIT frames using GNU backtrace. Patch by Diego Russo and Pablo Galindo

  • gh-149171: Allow assignment to the __module__ attribute of typing.TypeAliasType instances.

  • gh-149122: Fix a crash in optimized calls to all(), any(), tuple(), list(), and set() with an async generator expression argument (for example, tuple(await x for x in y)). These calls now correctly raise TypeError instead of crashing.

  • gh-149049: Fix stack underflow for BINARY_OP in tier 2.

  • gh-83065: Fix a deadlock that could occur when one thread is importing a submodule (for example import pkg.sub.mod) while another thread is importing one of its parent packages (for example import pkg.sub) and that parent’s __init__.py itself imports the submodule. The import system now acquires module locks in hierarchical (parent-before-child) order so the two threads serialise instead of raising _DeadlockError.

  • gh-113956: Fix a data race in sys.intern() in the free-threaded build when interning a string owned by another thread. An interned copy owned by the current thread is used instead when it is not safe to immortalize the original.

  • gh-148850: Fix the memory sanitizer false positive in os.getrandom().

  • gh-148820: Fix a race in _PyRawMutex on the free-threaded build where a Py_PARK_INTR return from _PySemaphore_Wait could let the waiter destroy its semaphore before the unlocking thread’s _PySemaphore_Wakeup completed, causing a fatal ReleaseSemaphore error.

  • gh-148829: Add sentinel, implementing PEP 661. PEP by Tal Einat; patch by Jelle Zijlstra.

  • gh-146270: Fix a sequential consistency bug in structmember.c.

  • gh-148766: The interpreter help (such as python --help) is now in color. Patch by Hugo van Kemenade.

  • gh-148571: Fix a crash in the JIT optimizer when specialized opcode families inherited incompatible recorded operand layouts.

  • gh-148653: Forbid marshalling recursive code objects, slice and frozendict objects which cannot be correctly unmarshalled.

  • gh-142516: Forward-port the generational cycle garbage collector to the default 3.15 build, replacing the incremental collector while leaving the free-threaded collector unchanged.

  • gh-146462: Added PyTypeObject.tp_basicsize, PyTypeObject.tp_dictoffset, and PyHeapTypeObject.ht_cached_keys offsets to _Py_DebugOffsets to support version-independent read-only dict introspection tools.

  • gh-145239: Unary plus is now accepted in match literal patterns, mirroring the existing support for unary minus. Patch by Bartosz Sławecki.

  • gh-148515: Fix a bug in the JIT optimizer reading operands for uops with multiple caches.

  • gh-148390: Fix an undefined behavior in memoryview when using the native boolean format (?) in cast(). Previously, on some common platforms, calling memoryview(b).cast("?").tolist() incorrectly returned [False] instead of [True] for any even byte b. Patch by Bénédikt Tran.

  • gh-148418: Fix a possible reference leak in a corrupted TYPE_CODE marshal stream.

  • 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-146527: Add a GCMonitor class with a get_gc_stats method to the _remote_debugging module to allow reading GC statistics from an external Python process without requiring the full RemoteUnwinder functionality. Patch by Sergey Miryanov and Pablo Galindo.

  • 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-148189: Repaired undercount of bytes in type-specific free lists reported by sys._debugmallocstats(). For types that participate in cyclic garbage collection, it was missing two pointers used by GC.

  • gh-148222: Fix vectorcall support in types.GenericAlias when the underlying type does not support the vectorcall protocol. Fix possible leaks in types.GenericAlias and types.UnionType in case of memory error.

  • gh-148208: Fix recursion depth leak in PyObject_Print()

  • gh-95004: The specializing interpreter now specializes for enum.Enum improving performance and scaling in free-threading. Patch by Kumar Aditya.

  • gh-149202: Enable frame pointers by default for GCC-compatible CPython builds, including -mno-omit-leaf-frame-pointer, -marm on 32-bit ARM, and/or -mbackchain on s390x platforms when the compiler supports them, so profilers and debuggers can unwind native interpreter frames more reliably. Users can pass --without-frame-pointers to ./configure to opt out.

  • gh-148014: Accept a function name in -X presite command line option and PYTHON_PRESITE environment variable. Patch by Victor Stinner.

  • gh-147998: Fixed a memory leak in interpreter helper calls so cleanup works when an operation falls across interpreter boundaries. Patch by Maurycy Pawłowski-Wieroński.

  • gh-146455: Fix O(N²) compile-time regression in constant folding after it was moved from AST to CFG optimizer.

  • gh-146306: Specialize float true division in the tier 2 optimizer with inplace mutation for uniquely-referenced operands.

  • gh-142186: Global sys.monitoring events can now be turned on and disabled on a per code object basis. Returning DISABLE from a callback disables the event for the entire code object (for the current tool).

  • gh-126910: Add support for unwinding JIT frames using GDB. Patch by Diego Russo and Pablo Galindo.

  • 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 encodings is now partially frozen, including the aliases and utf_8 submodules.

    The linecache is now frozen.

  • gh-134584: Optimize and eliminate redundant ref-counting for MAKE_FUNCTION in 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-98894: Restore function__entry and function__return DTrace/SystemTap probes that were broken since Python 3.11.

  • gh-116021: Support for creating instances of abstract AST nodes from the ast module is deprecated and scheduled for removal in Python 3.20. Patch by Brian Schubert.

  • gh-137814: Fix the __qualname__ attribute of __annotate__ functions on functions.

  • gh-137600: ast: The constructors of AST nodes now raise a TypeError when a required argument is omitted or when a keyword argument that does not map to a field on the AST node is passed. These cases had previously raised a DeprecationWarning since Python 3.13. Patch by Brian Schubert.

  • gh-137293: Fix SystemError when searching ELF Files in sys.remote_exec().

  • gh-135357: Add support for socket.SO_PASSRIGHTS on Linux.

  • gh-134690: Removed deprecated in PEP 626 since Python 3.12 codeobject.co_lnotab from types.CodeType.

  • gh-100239: Specialize BINARY_OP for concatenation of lists and tuples, and propagate the result type through _BINARY_OP_EXTEND in the tier 2 optimizer so that follow-up type guards can be eliminated.

Library

  • gh-148823: Defer the import of _colorize in argparse until needed for coloring output.

  • gh-141560: Add an annotation_format parameter to inspect.getfullargspec().

  • gh-139489: Add the xml.is_valid_text() function, which allows to check whether a string can be used in the XML document.

  • gh-142389: Add backticks to stdlib argparse help to display in colour. Patch by Hugo van Kemenade.

  • gh-149377: Update bundled pip to 26.1.1

  • gh-142389: Add backtick markup support in argparse option help text to highlight inline code when color output is enabled. Patch by Hugo van Kemenade.

  • gh-148675: Remove F and D formats from array and memoryview. Patch by Victor Stinner.

  • gh-149342: Fix _remote_debugging binary writing so that sampling a thread whose Python frame stack is empty (for example while it is in a C call or mid-syscall) no longer raises RuntimeError("Invalid stack encoding type"), and so that BinaryWriter.total_samples after finalize() or context-manager exit includes samples flushed from the RLE buffer. Patch by Maurycy Pawłowski-Wieroński.

  • gh-149010: The inspect module CLI now reports as much information as it has available for non-source modules when --details is specified, and provides an error message rather than a traceback when --details is omitted. It also reports improved information when the given target location is not the target’s defining location and when the given target is a data value rather than a class or function definition.

  • gh-146609: Use argparse for colour help timeit CLI. Patch by Hugo van Kemenade.

  • gh-142389: Add backticks for colour to regrtest and pdb’s help description. Patch by Hugo van Kemenade.

  • gh-144384: Lazily import _colorize. Patch by Hugo van Kemenade.

  • gh-149321: Fix import cycles exposed by running standard library modules with -X lazy_imports=none.

  • gh-145378: Generate consistent colors for pdb commands in pdb REPL.

  • gh-149296: Add a dump subcommand to profiling.sampling that prints a single traceback-style snapshot of a running process’s Python stack, including per-thread status, source line highlighting, optional bytecode opcode names, and async-aware task reconstruction. Patch by Pablo Galindo.

  • gh-143231: A module attribute has been added to warnings.WarningMessage.

  • gh-148675: ctypes: Change the _type_ of c_float_complex, c_double_complex and c_longdouble_complex from F, D and G to Zf, Zd and Zg for compatibility with numpy. Patch by Victor Stinner.

  • gh-148675: The array.typecodes type changed from str to tuple to support type codes longer than 1 character (Zf and Zd). Patch by Victor Stinner.

  • gh-149221: Catch rare math domain error for random.binomialvariate().

  • gh-149231: In tomllib, the number of parts in TOML keys is now limited.

  • gh-143231: unittest.TestCase.assertWarns() and unittest.TestCase.assertWarnsRegex() no longer swallow warnings that do not match the specified category or regex. Nested context managers are now supported.

  • gh-149214: Fix _remote_debugging misreading non-ASCII Unicode strings (Latin-1, BMP and non-BMP) from a remote process. Filenames and function names that contain non-ASCII characters are now reported correctly in stack traces, the sampling profiler, and asyncio task introspection.

  • gh-149189: pprint now uses modern defaults: indent=4 and width=88, and the default compact=False output is now formatted similar to pretty-printed json.dumps(), with opening parentheses and brackets followed by a newline and the contents indented by one level. The expand parameter, added in 3.15.0a8, has been removed; compact=False (the default) now produces the former expand=True layout. Patch by Hugo van Kemenade.

  • gh-149173: Fix inverted PYTHON_BASIC_REPL environment check in pdb._pyrepl_available.

  • gh-149117: Fix runpy.run_module() and runpy.run_path() to set the name attribute on the ImportError they raise.

  • gh-149148: ensurepip: Upgrade bundled pip to 26.1. This version fixes the CVE 2026-3219 vulnerability. Patch by Victor Stinner.

  • gh-149009: Validate that profiling.sampling binary profiles do not contain more unique (thread, interpreter) pairs than declared in the header. Patch by Maurycy Pawłowski-Wieroński.

  • gh-148292: ssl: Update ssl.SSLSocket and ssl.SSLObject for OpenSSL 4. The classes now remember if they get a ssl.SSLEOFError. In this case, following read(), sendfile(), write(), and do_handshake() calls raise ssl.SSLEOFError without calling the underlying OpenSSL function. Thanks to that, ssl.SSLSocket behaves the same on all OpenSSL versions on EOF. Patch by Victor Stinner.

  • gh-149085: Add a max_threads keyword argument to faulthandler.dump_traceback(), faulthandler.dump_traceback_later(), faulthandler.enable(), and faulthandler.register().

  • gh-148641: pkgutil.resolve_name() gets a new optional, keyword-only argument called strict. The default is False for backward compatibility.

  • gh-148093: Fix an out-of-bounds read of one byte in binascii.a2b_uu(). Raise binascii.Error, instead of reading past the buffer end.

  • gh-149083: dataclasses.MISSING and dataclasses.KW_ONLY are now instances of sentinel.

  • gh-148914: Fix memoization of in-band PickleBuffer in the Python implementation of pickle. Previously, identical PickleBuffers did not preserve identity, and empty writable PickleBuffer memoized an empty bytearray object in place of b'', so the following references to b'' were unpickled as an empty bytearray object.

  • gh-149026: Add colour to pickletools CLI output. Patch by Hugo van Kemenade.

  • gh-148991: Add colour to tokenize CLI output. Patch by Hugo van Kemenade.

  • gh-138907: Support RFC 9309 in urllib.robotparser.

  • gh-148981: Add color parameter to ast.dump().

  • gh-148849: Deprecate http.cookies.Morsel.js_output() and http.cookies.BaseCookie.js_output(), which will be removed in Python 3.19. Use http.cookies.Morsel.output() or http.cookies.BaseCookie.output() instead.

  • gh-146311: Add a canonical keyword-only parameter to the base16, base32, base64, base85, ascii85, and Z85 decoders in base64 and binascii. When true, encodings with non-zero padding bits (base16/32/64) or non-canonical encodings (base85/ascii85) are rejected. Single-character final groups in binascii.a2b_ascii85() and binascii.a2b_base85() are now always rejected as encoding violations, regardless of canonical; previously they were silently ignored and produced no output bytes.

  • gh-148947: Fix crash in @dataclasses.dataclass with slots=True that occurred when a function found within the class had an empty __class__ cell.

  • gh-148680: ForwardRef objects that contain internal names to represent known objects now show the type_repr of the known object rather than the internal __annotationlib_name_x__ name when evaluated as strings.

  • gh-124397: The threading module added tooling to support concurrent iterator access: threading.serialize_iterator, threading.synchronized_iterator(), and threading.concurrent_tee().

  • gh-148801: xml.etree.ElementTree: Fix a crash in Element.__deepcopy__ on deeply nested trees.

  • gh-148735: xml.etree.ElementTree: Fix a use-after-free in Element.findtext when the element tree is mutated concurrently during the search.

  • gh-148740: Fix usage for uuid command-line interface to support a custom namespace be provided for uuid3 and uuid5.

  • gh-148688: bz2, compression.zstd, lzma, zlib: Fix a double free on memory allocation failure. Patch by Victor Stinner.

  • gh-148675: array, struct: Add support for Zd and Zf formats for double complex and float complex. Patch by Victor Stinner.

  • gh-148651: Fix reference leak in compression.zstd.ZstdDecompressor when an invalid option key is passed.

  • gh-148641: PEP 829 (package startup configuration files) implements a new format <name>.start parallel to <name>.pth files, to replace import lines in the latter.

  • gh-148639: Implement PEP 800, adding the @typing.disjoint_base decorator. Patch by Jelle Zijlstra.

  • gh-148615: Fix pdb to accept standard – end of options separator. Reported by haampie. Patched by Shrey Naithani.

  • gh-146553: Fix infinite loop in typing.get_type_hints() when __wrapped__ forms a cycle. Patch by Shamil Abdulaev.

  • gh-148599: Update the socket module’s WSA error messages to match official documentation.

  • gh-148508: An intermittent timing error when running SSL tests on iOS has been resolved.

  • gh-144881: asyncio debugging tools (python -m asyncio ps and pstree) 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 --retries flag. Patch by Bartosz Sławecki.

  • gh-148518: If an email containing an address header that ended in an open double quote was parsed with a non-compat32 policy, accessing the username attribute of the mailbox accessed through that header object would result in an IndexError. It now correctly returns an empty string as the result.

  • gh-148464: Add missing __ctype_le/be__ attributes for c_float_complex and c_double_complex. Patch by Sergey B Kirpichev.

  • gh-148370: configparser: prevent quadratic behavior when a ParsingError is 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_text now allows/solicits an errors parameter.

  • gh-137855: Improve import time of dataclasses module by lazy importing re and copy modules.

  • gh-148352: Add more color to calendar’s CLI output. Patch by Hugo van Kemenade.

  • gh-148254: Use singular “sec” instead of “secs” in timeit verbose output for consistency with other time units.

  • gh-130472: Integrate fancycompleter with import completions.

  • gh-148241: json: Fix serialization: no longer call str(obj) on str subclasses. Patch by Victor Stinner.

  • gh-148225: The profiling.sampling replay command 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_boundary could 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-148207: typing.TypeVarTuple now accepts bound, covariant, contravariant, and infer_variance parameters, matching the interface of typing.TypeVar and typing.ParamSpec.

  • gh-148100: Soft deprecate re.match() and re.Pattern.match() in favour of re.prefixmatch() and re.Pattern.prefixmatch(). Patch by Hugo van Kemenade.

  • gh-147991: Improve tomllib import time (up to 10x faster). Patch by Victor Stinner.

  • gh-147957: Guarantees that collections.UserDict.popitem() will pop in the same order as the wrapped dictionary rather than an arbitrary order.

  • gh-146256: The profiling.sampling module now supports JSONL output format via --jsonl. Each run emits a newline-delimited JSON file that is sequentially parseable by external tools, scripts, and programmatic consumers. Patch by Maurycy Pawłowski-Wieroński.

  • gh-146609: Add colour to timeit CLI 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-137586: Add MacOS to webbrowser for macOS, which opens URLs via /usr/bin/open instead of piping AppleScript to osascript. Deprecate MacOSXOSAScript in favour of MacOS.

  • gh-146406: Cross-language method suggestions are now shown for AttributeError on builtin types and their subclasses. For example, [].push() suggests append, (1,2).append(3) suggests using a list, None.keys() suggests expecting a dict, and 1.0.__or__ suggests using an int.

  • gh-146313: Fix a deadlock in multiprocessing’s resource tracker where the parent process could hang indefinitely in os.waitpid() during interpreter shutdown if a child created via os.fork() still held the resource tracker’s pipe open.

  • gh-146292: Add colour to BaseHTTPRequestHandler logs, as used by the http.server CLI. Patch by Hugo van Kemenade.

  • gh-145917: Add MIME types for TTC and Haptics formats to mimetypes. (Contributed by Charlie Lin in gh-145918.)

  • gh-145846: Fix memory leak in _lsprof when clear() is called during active profiling with nested calls. clearEntries() now walks the entire currentProfilerContext linked list instead of only freeing the top context.

  • gh-145831: Fix email.quoprimime.decode() leaving a stray \r when eol='\r\n' by stripping the full eol string instead of one character.

  • gh-145378: Use PyREPL as the default input console for pdb

  • gh-145244: Fixed a use-after-free in json encoder when a default callback mutates the dictionary being serialized.

  • gh-117716: Fix wave writing of odd-sized data chunks 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-145056: Add support for frozendict in dataclasses.asdict() and dataclasses.astuple().

  • gh-145105: Fix crash in csv reader when iterating with a re-entrant iterator that calls next() on the same reader from within __next__.

  • gh-130750: Restore quoting of choices in argparse error messages for improved clarity and consistency with documentation.

  • gh-137855: Reduce the import time of dataclasses module by ~20%.

  • gh-70647: strptime() now raises ValueError when the format string contains %d without a year directive. Using %e without a year now emits a DeprecationWarning.

  • gh-105936: Attempting to mutate non-field attributes of dataclasses with both frozen and slots being True now raises FrozenInstanceError instead of TypeError. 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 json module where a use-after-free could occur if the object being encoded is modified during serialization.

  • gh-108411: typing.IO and typing.BinaryIO method arguments are now positional-only.

  • gh-130273: Fix traceback color output with Unicode characters.

  • gh-142307: imaplib: deprecate support for IMAP4.file. This attribute was never meant to be part of the public interface and altering its value may result in unclosed files or other synchronization issues with the underlying socket. Patch by Bénédikt Tran.

  • gh-141449: Improve tests and documentation for non-function callables as annotate functions.

  • gh-140287: The asyncio REPL now handles exceptions when executing PYTHONSTARTUP scripts. Patch by Bartosz Sławecki.

  • gh-139489: Add the xml.is_valid_name() function, which allows to check whether a string can be used as an element or attribute name in XML.

  • gh-75707: Add optional mtime argument to tarfile.open(), for setting the mtime header field in .tar.gz archives.

  • gh-125862: The contextlib.contextmanager() and contextlib.asynccontextmanager() decorators now work correctly with generators, coroutine functions, and async generators when the wrapped callables are used as decorators.

  • gh-135528: http.cookiejar: add “tv”, “or”, “nom”, “sch”, and “web” to the default list of supported country code second-level domains.

  • gh-135056: Add a -H or --header CLI option to python -m http.server. Contributed by Anton I. Sipos.

  • gh-134551: Add t-strings support to pprint functions

  • gh-133956: Fix bug where @dataclass wouldn’t detect ClassVar fields if ClassVar was re-exported from a module other than typing.

  • gh-132631: Fix “I/O operation on closed file” when parsing JSON Lines file with JSON CLI.

  • gh-108951: asyncio: Add TaskGroup.cancel which cancels unfinished tasks and exits the group without raising asyncio.CancelledError.

  • 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-122476: The email module no longer incorrectly uses RFC 2047 encoding for a mailbox with non-ASCII characters in its local-part. Under a policy with utf8 set False, attempting to serialize such a message will now raise an HeaderWriteError. There is no valid 7-bit encoding for an internationalized local-part. Use email.policy.SMTPUTF8 (or another policy with utf8=True) to correctly pass through the local-part as Unicode characters.

  • gh-83938: The email module no longer incorrectly uses RFC 2047 encoding for a mailbox with non-ASCII characters in its domain. Under a policy with utf8 set False, attempting to serialize such a message will now raise an HeaderWriteError. Either apply an appropriate IDNA encoding to convert the domain to ASCII before serialization, or use email.policy.SMTPUTF8 (or another policy with utf8=True) to correctly pass through the internationalized domain name as Unicode characters.

  • gh-81074: The email module no longer treats email addresses with non-ASCII characters as defects when parsing a Unicode string or in the addr_spec parameter to email.headerregistry.Address. RFC 5322 permits such addresses, and they were already supported when parsing bytes and in the Address username parameter.

    The (undocumented) email.errors.NonASCIILocalPartDefect is no longer used and should be considered deprecated.

  • gh-70039: Fixed bug where smtplib.SMTP.starttls() could fail if smtplib.SMTP.connect() is called explicitly rather than implicitly.

  • gh-113471: Allow http.server to set a default content-type when serving files with an unknown or missing extension.

  • gh-83281: email: improve handling trailing garbage in address lists to avoid throwing AttributeError in certain edge cases

  • gh-96894: Do not turn echo off for subsequent commands in batch activators (activate.bat and deactivate.bat) of venv.

Documentation

Tests

  • gh-149425: Increase time delta in test.test_zipfile.test_core.OtherTests.test_write_without_source_date_epoch

  • gh-148600: Add OpenSSL 4.0.0 support to test configurations.

Build

  • gh-149353: Avoid unnecessary JIT-related rebuilds during make install after --enable-optimizations builds.

  • gh-149351: Avoid possible broken macOS framework install names when DESTDIR is specified during builds.

  • gh-149252: Update to WASI SDK 33.

  • gh-148690: Windows free-threaded builds now output to a different default path with default filenames, for example, PCbuild/amd64t/python.exe rather than PCbuild/amd64/python3.15t.exe. The PC/layout script has been updated to ensure compatibility of generated layouts.

  • gh-146475: Block Apple Clang from being used to build the JIT as it ships without required LLVM tools.

  • gh-148644: Errors during the PGO training job on Windows are no longer ignored, and a non-zero return code will cause the build to fail.

  • gh-148535: No longer use the gcc -fprofile-update=atomic flag 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=atomic on i686 anymore. Patch by Victor Stinner.

  • gh-148483: Use Py_GCC_ATTRIBUTE(unused) for stop_tracing label.

  • gh-148474: Fixed compilation of Python/pystrhex.c with 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-138451: Allow for custom LLVM path using LLVM_TOOLS_INSTALL_DIR during JIT build.

  • gh-133312: Add a new ./configure option --enable-static-libpython-for-interpreter which, 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-shared had 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.

Windows

  • gh-149254: Updated bundled version of OpenSSL to 3.5.6.

  • gh-148690: Non-freethreaded builds on Windows now support extensions linked to python3t.dll, and will include a copy of that library in normal installs that references the non-freethreaded runtime.

  • gh-146458: Fix incorrect REPL height and width tracking on console window resize on Windows.

macOS

  • gh-142295: For Python macOS framework builds, update Info.plist files to be more compliant with current Apple guidelines. Original patch contributed by Martinus Verburg.

  • gh-149254: Update macOS installer to use OpenSSL 3.5.6.

IDLE

  • gh-94523: Detect file if modified at local disk and prompt to ask refresh. Patch by Shixian Li.

  • gh-139551: Support rendering BaseExceptionGroup in 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.

C API

Python 3.15.0 alpha 8

Release date: 2026-04-07

Security

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_EXTEND in the tier 2 optimizer, enabling elimination of downstream type guards and selection of inplace float operations.

  • gh-148144: Initialize _PyInterpreterFrame.visited when copying interpreter frames so incremental GC does not read an uninitialized byte from generator and frame-object copies.

  • gh-148072: Cache pickle.dumps and pickle.loads per interpreter in the XIData framework, avoiding repeated module lookups on every cross-interpreter data transfer. This speeds up InterpreterPoolExecutor for 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_SET for frozenset. 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 to set.__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_norm benchmark 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-gnu JIT code, allowing most native profilers and debuggers to unwind through them. Patch by Diego Russo

  • gh-146388: Adds a null check to handle when the JIT optimizer runs out of space when dealing with contradictions in make_bottom.

  • gh-146308: Fixed multiple error handling issues in the _remote_debugging module 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 nbody benchmark 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 SyntaxError when re-initializing it.

  • gh-146245: Fixed reference leaks in socket when audit hooks raise exceptions in socket.getaddrinfo() and socket.sendto().

  • gh-146151: memoryview now 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_uint16 in 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(), and select.devpoll.close() silently ignored errors.

  • gh-146199: Comparison of code objects now handles errors correctly.

  • gh-145667: Remove the GET_ITER_YIELD_FROM instruction, modifying SEND to pair with GET_ITER when compiling yield from expressions.

  • gh-146192: Add Base32 support to binascii and improve the performance of the Base32 converters in base64. 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 containing NULLs.

  • gh-145059: Fixed sys.lazy_modules to include lazy modules without submodules. Patch by Bartosz Sławecki.

  • gh-146041: Fix free-threading scaling bottleneck in sys.intern() and PyObject_SetAttr() by avoiding the interpreter-wide lock when the string is already interned and immortalized.

  • gh-145990: python --help-env sections are now sorted by environment variable name.

  • gh-145990: python --help-xoptions is now sorted by -X option name.

  • gh-145876: AttributeErrors and KeyErrors raised in keys() or __getitem__() during dictionary unpacking ({**mymapping} or func(**mymapping)) are no longer masked by TypeError.

  • 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() and staticmethod() 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 a list

  • gh-134584: Eliminate redundant refcounting for MATCH_CLASS in the JIT.

  • gh-69605: Add math.integer to REPL auto-completion of imports.

  • gh-131798: Optimize _ITER_CHECK_RANGE and _ITER_CHECK_LIST in the JIT

  • gh-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-gnu JIT 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

Documentation

  • gh-126676: Expand argparse documentation for type=bool with a demonstration of the surprising behavior and pointers to common alternatives.

  • gh-145649: Fix text wrapping and formatting of -X option descriptions in the python(1) man page by using proper roff markup.

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=atomic option 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-epoll to configure

  • gh-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.h or empty stropts.h

Windows

  • gh-140131: Fix REPL cursor position on Windows when module completion suggestion line hits console width.

macOS

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/vgrindefs and Misc/Porting.

C API

Python 3.15.0 alpha 7

Release date: 2026-03-10

Windows

Tests

  • gh-144741: Fix test_frame_pointer_unwind when 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

Library

Documentation

Core and Builtins

  • gh-145701: Fix SystemError when __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 -1 as the path argument.

  • gh-145376: Fix reference leaks in various unusual error scenarios.

  • gh-145234: Fixed a SystemError in 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_warnings and PYTHON_PATHCONFIG_WARNINGS options, 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 with items are followed by a trailing comma (for example, with item,:), raising a clearer SyntaxError message. 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 accepts frozendict.

  • gh-144015: Speed up bytes.hex(), bytearray.hex(), binascii.hexlify(), and hashlib .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 accepts frozendict as an argument.

  • gh-145064: Fix JIT optimizer assertion failure during CALL_ALLOC_AND_ENTER_INIT side exit.

  • gh-145055: exec() and eval() now accept frozendict for globals. Patch by Victor Stinner.

  • gh-145058: Fix a crash when __lazy_import__() is passed a non-string argument, by raising an TypeError instead.

  • gh-144995: Optimize memoryview comparison: a memoryview is 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_EXTEND for exact floats and medium-size integers by up to 15%. Patch by Chris Eibl.

  • gh-144914: Use mimalloc for raw memory allocations such as via PyMem_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 start and multi_line_start pointers are NULL in _PyLexer_remember_fstring_buffers() and _PyLexer_restore_fstring_buffers(). The NULL pointer arithmetic (NULL - valid_pointer) is now guarded with explicit NULL checks.

  • gh-141510: Add built-in frozendict type. 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_SLICE for list, tuple, and unicode by avoiding temporary slice object 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_CLASS performance 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

Build

  • gh-144533: Use wasmtime’s --argv0 to auto-discover sysconfig in WASI builds

  • gh-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

  • gh-144648: Allowed _remote_debugging to build on more OS versions by using proc_listpids() rather than proc_listallpids().

  • gh-124111: Update macOS installer to use Tcl/Tk 9.0.3.

  • gh-144551: Update macOS installer to use OpenSSL 3.5.5.

Windows

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 wantobjects in regrtests, which allows to run Tkinter tests with the specified value of tkinter.wantobjects, for example -u wantobjects=0.

Security

  • gh-144125: BytesGenerator will now refuse to serialize (write) headers that are unsafely folded or delimited; see verify_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.Morsel fields and values.

  • gh-143916: Reject C0 control characters within wsgiref.headers.Headers fields, values, and parameters.

Library

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_SLICE

  • gh-144563: Fix interaction of the Tachyon profiler and ctypes and 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 Galindo

  • gh-144601: Fix crash when importing a module whose PyInit function 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_SLICE in the JIT.

  • gh-144330: Move classmethod and staticmethod initialization 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, and ag_state attributes to generators, coroutines, and async generators that return the current state as a string (e.g., GEN_RUNNING). The inspect module functions getgeneratorstate(), getcoroutinestate(), and getasyncgenstate() 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 in PyModuleDef.

  • 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_yieldfrom thread-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 NULL in BINARY_OP_EXTENT opcode.

  • 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 set when 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_list function.

  • gh-143650: Fix race condition in importlib where 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_MODULE or LOAD_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 by Py_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: bytearray buffers 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

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_NAME and _PY_IMPL_CACHE_TAG preprocessor definitions to override sys.implementation at build time. Definitions need to include quotes when setting to a string literal. Setting the cache tag to NULL has the effect of completely disabling automatic creation and use of .pyc files.

  • 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 deprecated Tools/wasm/wasi/__main__.py behind 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

  • gh-143082: Fix pdb arrow key history not working when stdin is sys.stdin.

  • gh-128067: Fix a bug in PyREPL on Windows where output without a trailing newline was overwritten by the next prompt.

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

  • gh-143460: Skip tests relying on infinite recusion if stack size is unlimited.

  • gh-143553: Add support for parametrized resources, such as -u xpickle=2.7.

  • bpo-31391: Forward-port test_xpickle from Python 2 to Python 3 and add the resource back to test’s command line.

Library

  • gh-143706: Fix multiprocessing forkserver so that sys.argv is correctly set before __main__ is preloaded. Previously, sys.argv was 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.Pickler and pickle.Unpickler methods for the C implementation. Previously, this could cause crash or data corruption, now concurrent calls of methods of the same object raise RuntimeError.

  • gh-143658: importlib.metadata: Use str.translate() to improve performance of importlib.metadata.Prepared.normalize(). Patch by Hugo van Kemenade and Henry Schreiner.

  • gh-78724: Raise RuntimeError’s when user attempts to call methods on half-initialized Struct objects, For example, created by Struct.__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 raises ValueError if the stack size is too small. Patch by Victor Stinner.

  • gh-143547: Fix sys.unraisablehook() when the hook raises an exception and changes sys.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 a SyntaxError when 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_ATOMIC constant for Linux 6.11+.

  • gh-143445: Speed up copy.deepcopy() by 1.04x.

  • gh-143378: Fix use-after-free crashes when a BytesIO object is concurrently mutated during write() or writelines().

  • gh-143368: Fix endless retry loop in profiling.sampling blocking mode when threads cannot be seized due to EPERM. 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._PlistWriter when the indent contains a mix of tabs and spaces.

  • gh-140025: queue: Fix SimpleQueue.__sizeof__() computation.

  • gh-143310: tkinter: fix a crash when a Python list is 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 a PickleBuffer is 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 logging handlers.

  • gh-143249: Fix possible buffer leaks in Windows overlapped I/O on error handling.

  • gh-143241: zoneinfo: fix infinite loop in ZoneInfo.from_file when 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 of Element when the element is concurrently mutated. Patch by Bénédikt Tran.

  • gh-143214: Add the wrapcol parameter in binascii.b2a_base64() and base64.b64encode().

  • gh-142195: Updated timeout evaluation logic in subprocess to 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 the pad parameter.

  • gh-130796: Undeprecate the locale.getdefaultlocale() function. Patch by Victor Stinner.

  • gh-74902: Add the iter_graphemes() function in the unicodedata module to iterate over grapheme clusters according to rules defined in Unicode Standard Annex #29, “Unicode Text Segmentation”. Add grapheme_cluster_break(), indic_conjunct_break() and extended_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 asyncio REPL now respects the -I flag (isolated mode). Previously, it would load and execute PYTHONSTARTUP even 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 lzma thread-safe on the free threaded build.

  • gh-142950: Fix regression in argparse where format specifiers in help strings raised ValueError.

  • gh-142881: Fix concurrent and reentrant call of atexit.unregister().

  • gh-142615: Fix possible crashes when initializing asyncio.Task or asyncio.Future multiple 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-compat32 email policies 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 _colorize theming system. Users can customize colors via _colorize.set_theme() (experimental API, subject to change). A LiveProfilerLight theme is provided for light terminal backgrounds. Patch by Pablo Galindo.

  • gh-142306: Improve errors for Element.remove.

  • gh-63016: Add a flags parameter to mmap.mmap.flush() to control synchronization behavior.

  • gh-139262: Some keystrokes can be swallowed in the new PyREPL on Windows, especially when used together with the ALT key. Fix by Chris Eibl.

  • gh-138897: Improved license/copyright/credits display in the REPL: now uses a pager.

  • gh-135852: Add _winapi.RegisterEventSource(), _winapi.DeregisterEventSource() and _winapi.ReportEvent(). Using these functions in NTEventLogHandler to replace pywin32.

  • gh-109263: Starting a process from spawn context in multiprocessing no longer sets the start method globally.

  • gh-132715: Skip writing objects during marshalling once a failure has occurred.

Documentation

Core and Builtins

  • gh-134584: Eliminate redundant refcounting from _CONTAINS_OP, _CONTAINS_OP_SET and _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_MODULE specialization 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_INT to 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_EX for 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_OFFSET to _Py_CallBuiltinClass_StackRefSteal to avoid redundant allocations

  • gh-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-str key 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 bytearray is mutated while formatting the %-style arguments. Patch by Bénédikt Tran.

  • gh-143195: Fix use-after-free crashes in bytearray.hex() and memoryview.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.inspect to 1 when PYTHONINSPECT is 0. Previously, it was set to 0 in 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 float and int with 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.Context comparison when a custom __eq__ method modifies the context via set().

  • gh-142863: Generate optimized bytecode when calling list or set with generator expression.

  • gh-41779: Allowed defining any __slots__ for a class derived from tuple (including classes created by collections.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 Roun

  • gh-132108: Speed up int.from_bytes() when passed object supports buffer protocol, like bytearray by ~1.2x.

  • gh-128334: Make the slice class subscriptable at runtime to be consistent with typing implementation.

C API

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 that nelements must be non-negative instead of positive.

  • gh-143046: The asyncio REPL no longer prints copyright and version messages in the quiet mode (-q). Patch by Bartosz Sławecki.

  • gh-80744: Fix issue where pdb would read a .pdbrc twice if launched from the home directory

  • gh-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 mailbox where 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 pdb commands command 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 VERSION from xml.etree.ElementTree and version from xml.sax.expatreader and xml.sax.handler. Patch by Hugo van Kemenade.

  • gh-142784: The asyncio REPL 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.sampling for compact storage of profiling data. The new --binary option captures samples to a file that can be converted to other formats using the replay command. Patch by Pablo Galindo

  • gh-142495: collections.defaultdict now prioritizes __setitem__() when inserting default values from default_factory. This prevents race conditions where a default value would overwrite a value set before default_factory returns.

  • gh-142654: Show the clearer error message when using profiling.sampling on an unknown PID.

  • gh-142560: Fix use-after-free in bytearray search-like methods (find(), count(), index(), rindex(), and rfind()) by marking the storage as exported which causes reallocation attempts to raise BufferError. For contains(), split(), and rsplit() the buffer protocol is used for this.

  • gh-142419: mmap.mmap.set_name() method added to annotate an anonymous memory map if Linux kernel supports PR_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() or error()) were incorrectly added to urllib.request.OpenerDirector’s handlers. Contributed by Andrea Mattei.

  • gh-136282: Add support for UNNAMED_SECTION when creating a section via the mapping protocol access

Core and Builtins

  • gh-143057: Avoid locking in PyTraceMalloc_Track() and PyTraceMalloc_Untrack() when tracemalloc is 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 lib folder 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_vars less fragile by clearing the environment variables before parsing the Makefile.

Security

  • gh-142145: Remove quadratic behavior in xml.minidom node ID cache clearing.

  • gh-42400: Fix buffer overflow in _Py_wrealpath() for paths exceeding MAXPATHLEN bytes 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.client module. When connecting to a malicious server, it could cause an arbitrary amount of memory to be allocated. This could have led to symptoms including a MemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.

  • gh-119342: Fix a potential memory denial of service in the plistlib module. 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 a MemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.

Library

  • gh-142754: Add the ownerDocument attribute to xml.dom.minidom elements and attributes created by directly instantiating the Element or Attr class. Note that this way of creating nodes is not supported; creator functions like xml.dom.Document.documentElement() should be used instead.

  • gh-142594: Fix crash in TextIOWrapper.close() when the underlying buffer’s closed property calls detach().

  • gh-76007: Deprecate __version__ from ctypes. Patch by Hugo van Kemenade.

  • gh-76007: Deprecate __version__ from wsgiref.simple_server. Patch by Hugo van Kemenade.

  • gh-142651: unittest.mock: fix a thread safety issue where Mock.call_count may return inaccurate values when the mock is called concurrently from multiple threads.

  • gh-76007: Deprecate __version__ from http.server. Patch by Hugo van Kemenade.

  • gh-138122: Add --subprocesses flag to profiling.sampling CLI 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 use multiprocessing, ProcessPoolExecutor, or other subprocess-based parallelism. Patch by Pablo Galindo.

  • gh-142595: Added type check during initialization of the decimal module 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=exception to 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 in SyntaxErrors when the source contains wide characters.

  • gh-123241: Avoid reference count operations in garbage collection of ctypes objects.

  • gh-142451: hmac: correctly copy HMAC attributes for objects copied through HMAC.copy(). Patch by Bénédikt Tran.

  • gh-138122: The profiling.sampling flamegraph 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 argparse no 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 --opcodes flag. 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 Galindo

  • gh-142389: Add backtick markup support in argparse description and epilog text to highlight inline code when color output is enabled.

  • gh-142346: Fix usage formatting for mutually exclusive groups in argparse when 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. in argparse.

  • 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 argparse to preserve | separators in mutually exclusive groups when the usage line wraps due to length.

  • gh-142267: Improve argparse performance by caching the formatter used for argument validation.

  • gh-139862: Remove color parameter from argparse.HelpFormatter constructor. Color is controlled by ArgumentParser.

  • gh-68552: MisplacedEnvelopeHeaderDefect and Missing header name defects are now correctly passed to the handle_defect method of policy in FeedParser.

  • gh-142206: The resource tracker in the multiprocessing module 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 dataclasses in Python 3.14.1 related to annotations.

    • An exception is no longer raised if slots=True is used and the __init__ method does not have an __annotate__ attribute (likely because init=False was 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_debugging module now implements frame caching in the RemoteUnwinder class to reduce memory reads when profiling remote processes. When cache_frames=True, unchanged portions of the call stack are reused from previous samples, significantly improving profiling performance for deep call stacks.

  • gh-116738: Fix cmath data race when initializing trigonometric tables with subinterpreters.

  • gh-141982: Allow pdb to set breakpoints on async functions with function names.

  • gh-74389: When the stdin being used by a subprocess.Popen instance is closed, this is now ignored in subprocess.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 argparse help, like %(default)s or %(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 a TimeoutExpired exception before the process has died, it should no longer hang.

  • gh-141999: Correctly allow KeyboardInterrupt to stop the process when using profiling.sampling.

  • gh-142006: Fix a bug in the email.policy.default folding 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 re compilation of regexes with large charsets by using bytearray.take_bytes().

  • gh-141968: Remove data copy from encodings.idna encode() and encode() by using bytearray.take_bytes().

  • gh-141968: Remove data copy from codecs punycode encoding by using bytearray.take_bytes().

  • gh-141968: Remove data copy from wave.Wave_read.readframes() and wave.Wave_write.writeframes() by using bytearray.take_bytes().

  • gh-141968: Remove a data copy from base64.b32decode() and base64.b32encode() by using bytearray.take_bytes().

  • gh-59000: Fix pdb breakpoint resolution for class methods when the module defining the class is not imported.

  • gh-116738: Fix thread safety issue with re scanner objects in free-threaded builds.

  • gh-138122: The profiling.sampling flamegraph 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_HDRINCL constant.

  • gh-105836: Fix asyncio.run_coroutine_threadsafe() leaving underlying cancelled asyncio task running.

  • gh-141570: Support file-like object raising OSError from fileno() in color detection (_colorize.can_colorize()). This can occur when sys.stdout is redirected.

  • gh-141679: Add colour to defaults in argparse help. Patch by Hugo van Kemenade.

  • gh-141686: Break reference cycles created by each call to json.dump() or json.JSONEncoder.iterencode().

  • gh-141659: Fix bad file descriptor errors from _posixsubprocess on AIX.

  • gh-141645: Add a new --live mode to the tachyon profiler in profiling.sampling module. This mode consist of a live TUI that displays real-time profiling statistics as the target application runs, similar to top. Patch by Pablo Galindo

  • gh-141615: Check stdin instead of stdout for use_rawinput in pdb.

  • gh-69113: Fix doctest to 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 a BufferError.

  • gh-116738: Make csv module thread-safe on the free threaded build.

  • gh-140911: collections: Ensure that the methods UserString.rindex() and UserString.index() accept collections.UserString instances as the sub argument.

  • gh-140875: Fix handling of unclosed character references (named and numerical) followed by the end of file in html.parser.HTMLParser with convert_charrefs=False.

  • gh-140677: Add heatmap visualization mode to the Tachyon sampling profiler. The new --heatmap output 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: Fix DeprecationWarning being 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 to add_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 References and In-Reply-To headers to the email library that parses the header content as lists of message id tokens. This prevents them from being folded incorrectly.

  • gh-135559: Flag: a dir() on a Flag enumeration now shows non-canonical members. (i.e. aliases).

  • gh-134453: Fixed subprocess.Popen.communicate() input= handling of memoryview instances 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__ to tkinter.simpledialog.

  • gh-115952: Fix a potential memory denial of service in the pickle module. 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 the find_class() method. This could have led to symptoms including a MemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.

  • bpo-40350: Fix support for namespace packages in modulefinder.

Documentation

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 bz2 thread-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 zlib thread-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 str key 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 of importlib.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 dev is used or Python is built in debug mode. Patch by Donghee Na.

  • gh-142029: Raise ModuleNotFoundError instead of crashing when a nonexistent module is used as a name in _imp.create_builtin().

  • gh-142029: Raise ValueError instead 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_EXECUTOR instruction.

  • gh-141930: When importing a module, use Python’s regular file object to ensure that writes to .pyc files 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 in gc.get_stats() and gc.callbacks.

  • gh-141780: Fix Py_mod_gil with API added in PEP 793: PyModule_FromSlotsAndSpec() and PyModExport hooks

  • gh-141732: Ensure the __repr__() for ExceptionGroup and BaseExceptionGroup does not change when the exception sequence that was original passed in to its constructor is subsequently mutated.

  • gh-140638: Expose a "duration" stat in gc.get_stats() and gc.callbacks.

  • gh-139653: Only raise a RecursionError or 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 counter to use prime numbers instead of powers of 2. Use only 3 bits for counter and 13 bits for value. 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 set object 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

Build

  • gh-131372: Add LDVERSION and EXE to the base_interpreter value of build-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.py will only be installed as part of the main install (make install). make altinstall will no longer include it.

  • gh-142234: Allow --enable-wasm-dynamic-linking for 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: RUNSHARED is no longer cleared when cross-compiling. Previously, RUNSHARED was cleared when cross-compiling, which breaks PGO when using --enabled-shared on 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.c compilation on 32-bit Linux. Include Python.h before system headers to make sure that _remote_debugging_module.c uses 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=FILE allows which distributors to pass a JSON configuration file containing custom error messages for missing standard library modules.

  • gh-108819: Honor --with-platlibdir in the pure-Python standard library installation path, if PLATLIBDIR doesn’t match the value used in LIBDIR.

Python 3.15.0 alpha 2

Release date: 2025-11-18

Windows

  • gh-140849: Update bundled liblzma to version 5.8.1.

Tools/Demos

  • gh-141442: The iOS testbed now correctly handles test arguments that contain spaces.

  • gh-140702: The iOS testbed app will now expose the GITHUB_ACTIONS environment variable to iOS apps being tested.

  • gh-139198: Remove Tools/scripts/checkpip.py script.

  • gh-139188: Remove Tools/tz/zdump.py script.

Tests

  • gh-140482: Preserve and restore the state of stty echo as part of the test environment.

  • gh-140082: Update python -m test to set FORCE_COLOR=1 when being run with color enabled so that unittest which is run by it with redirected output will output in color.

  • gh-136442: Use exitcode 1 instead of 5 if unittest.TestCase.setUpClass() raises an exception

Security

Library

Core and Builtins

  • gh-141579: Fix sys.activate_stack_trampoline() to properly support the perf_jit backend. 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.destroy function when warning about remaining subinterpreters. Patch by Sergey Miryanov.

  • gh-141367: Specialize CALL_LIST_APPEND instruction 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 to profiling.sampling output to denote active garbage collection and calls to native code.

Library

  • gh-140942: Add .cjs to mimetypes to give CommonJS modules a MIME type of application/node.

Core and Builtins

Library

  • gh-140260: Fix struct data race in endian table initialization with subinterpreters. Patch by Shamil Abdulaev.

Core and Builtins

  • gh-140530: Fix a reference leak when raise exc from cause fails. Patch by Bénédikt Tran.

Library

Core and Builtins

  • gh-140373: Correctly emit PY_UNWIND event when generator object is closed. Patch by Mikhail Efimov.

  • gh-140729: Fix pickling error in the sampling profiler when using concurrent.futures.ProcessPoolExecutor script can not be properly pickled and executed in worker processes.

  • gh-131527: Dynamic borrow checking for stackrefs is added to Py_STACKREF_DEBUG mode. 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 dict if dict.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() with strict=True when the input iterables have different lengths. Patch by Mikhail Efimov.

  • gh-133467: Fix race when updating type.__bases__ that could allow a read of type.__base__ to observe an inconsistent value on the free threaded build.

  • gh-140471: Fix potential buffer overflow in ast.AST node initialization when encountering malformed _fields containing non-str.

Library

  • gh-140443: The logarithm functions (such as math.log10() and math.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

Library

Core and Builtins

  • gh-140406: Fix memory leak when an object’s __hash__() method returns an object that isn’t an int.

  • 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 PyConfig in 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 atexit handlers under no memory.

  • gh-139871: Update bytearray to use a bytes under the hood as its buffer and add bytearray.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 to typing.TypeAliasType. Patch by Mikhail Efimov.

  • gh-135801: Many functions related to compiling or parsing Python code, such as compile(), ast.parse(), symtable.symtable(), and importlib.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 for return/break/continue in finally (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 finally block.

  • gh-139475: Changes in stackref debugging mode when Py_STACKREF_DEBUG is 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 SyntaxError message when invalid syntax appears on the same line as a valid import ... as ... or from ... import ... as ... statement. Patch by Brian Schubert.

  • gh-138857: Improve SyntaxError message for case keyword placed outside match body.

  • gh-131253: Support the --enable-pystats build 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_DICT and Py_TPFLAGS_MANAGED_WEAKREF are used, then Py_TPFLAGS_HAVE_GC must be used as well.

C API

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_INTERP is enabled but either preserve_none or musttail is not supported.

  • gh-140475: Support WASI SDK 25.

  • gh-140239: Check statx availability only on Linux (including Android).

  • gh-140189: iOS builds were added to CI.

  • gh-137618: PYTHON_FOR_REGEN now 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 updater postinstall script from the Update Shell Profile.command to 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]-dev will 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 PyMutex while 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.h files based on compiler settings, as it was frequently causing extension builds to break. In particular, the Py_GIL_DISABLED preprocessor variable must now always be defined explicitly when compiling for the experimental free-threaded runtime. The sysconfig.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 mode 0o700 on 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_DEBUG macro rather than _DEBUG in 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.sh script, 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 iOS folder has been moved to be a subdirectory of the Apple folder.

  • 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/wasi put the build Python into a directory named after the build triple instead of “build”.

  • gh-137025: The wasm_build.py script has been removed. Tools/wasm/emscripten and Tools/wasm/wasi should be used instead, as described in the Dev Guide.

  • gh-137248: Add a --logdir option to Tools/wasm/wasi for 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_example

  • gh-135968: Stubs for strip are 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 --verbose option 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_packages folder as a site directory.

  • gh-135494: Fix regrtest to support excluding tests from --pgo tests. Patch by Victor Stinner.

  • gh-132815: Fix test__opcode: add JUMP_BACKWARD to 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 ssl module 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_displays which 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 run input_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 by ExternalEntityParserCreate(). Patch by Sebastian Pipping.

  • gh-139283: sqlite3: correctly handle maximum number of rows to fetch in Cursor.fetchmany and reject negative values for Cursor.arraysize. Patch by Bénédikt Tran.

  • gh-136053: marshal: fix a possible crash when deserializing slice objects.

  • gh-135661: Fix parsing start and end tags in html.parser.HTMLParser according 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\f and 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.HTMLParser according 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.HTMLParser according 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 tarfile extraction filters (filter="data" and filter="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_TLS13 whether the ssl module 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 ipaddress to prevent excessive memory consumption and a minor denial-of-service.

Library

IDLE

  • gh-96491: Deduplicate version number in IDLE shell title bar after saving to a file.

  • gh-139742: Colorize t-string prefixes for template strings in IDLE, as done for f-string prefixes.

Documentation

  • gh-136155: We are now checking for fatal errors in EPUB builds in CI.

  • gh-135171: Document that the iterator for the leftmost for clause in the generator expression is created immediately.

  • bpo-45210: Document that error indicator may be set in tp_dealloc, and how to avoid clobbering it.

Core and Builtins

  • gh-140000: Fix potential memory leak when a reference cycle exists between an instance of typing.TypeAliasType, typing.TypeVar, typing.ParamSpec, or typing.TypeVarTuple and 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 Union type. Patch by Bénédikt Tran.

  • gh-139748: Fix reference leaks in error branches of functions accepting path strings or bytes such as compile() and os.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 tracemalloc simultaneously.

  • gh-139275: Fix compilation problems in _remote_debugging_module.c when the system doesn’t have process_vm_readv. Patch by Pablo Galindo

  • gh-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

Core and Builtins

Library

Core and Builtins

  • gh-138372: Fix SyntaxWarning emitted for erroneous subscript expressions involving template string literals. Patch by Brian Schubert.

  • gh-138302: BINARY_OP now specializes to BINARY_OP_ADD_INT, BINARY_OP_SUBTRACT_INT or BINARY_OP_MULTIPLY_INT if operands are compact ints.

  • gh-138318: The default REPL now avoids highlighting built-in names (for instance set or format()) when they are used as attribute names (for instance in value.set or text.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: zipimport now supports zstandard compressed zip file entries.

Library

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 warnings module in a finalizer at shutdown. Patch by Kumar Aditya.

Library

  • gh-138004: On Solaris/Illumos platforms, thread names are now encoded as ASCII to avoid errors on systems (e.g. OpenIndiana) that don’t support non-ASCII names.

  • gh-137976: Removed localtime from the list of reported system timezones.

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 Galindo

  • gh-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 AttributeError message for invalid mock assertions

  • gh-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 PYTHONSTARTUP is 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_INVERT in JIT builds with constant-loading uops (_POP_TWO_LOAD_CONST_INLINE_BORROW and _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() or PyEval_SetTraceAllThreads() or their Python equivalents threading.settrace_all_threads() and threading.setprofile_all_threads().

  • gh-133143: Add sys.abi_info object 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() or PyEval_SetTraceAllThreads() or their Python equivalents threading.settrace_all_threads() and threading.setprofile_all_threads().

  • gh-120037: Disable user site packages directory when a ._pth file is used, even if it contains import 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 pass statement to ensure that the node’s body is never empty. There was a ValueError in compile() 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_FLOAT and _COMPARE_OP_STR in JIT builds

  • gh-127598: Improve ModuleNotFoundError by adding flavour text to the exception when the -S option 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__() of ImportError and ModuleNotFoundError now shows “name” and “path” as name=<name> and path=<path> if they were given as keyword arguments at construction time. Patch by Serhiy Storchaka, Oleg Iarygin, and Yoav Nir

Library

Core and Builtins

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

Core and Builtins

  • gh-136517: Fixed a typo that prevented printing of uncollectable objects when the gc.DEBUG_UNCOLLECTABLE mode was set.

  • gh-136525: Fix issue where per-thread bytecode was not instrumented for newly created threads.

  • gh-132657: Improve performance of frozenset by 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=1 can be appended to enable the trampoline.

  • gh-132661: Interpolation.expression now has a default, the empty string.

  • gh-132661: Reflect recent PEP 750 change.

    Disallow concatenation of string.templatelib.Template and str. 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 -b and -bb command 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_subclasses dictionary are needed in order to correctly invalidate type caches (for example, by calling PyType_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 TypeError error message, when richcomparing two types.MappingProxyType objects.

  • gh-136003: Fix threading.Thread objects becoming incorrectly daemon when created from an atexit callback or a pending call (Py_AddPendingCall()).

  • gh-78465: Fix error message for cls.__new__(cls, ...) where cls is not instantiable builtin or extension type (with tp_new set to NULL).

  • 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_TOP in 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_OP for 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 weakref races 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 PyLongObject conversion functions PyLong_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_exec audit event when sys.remote_exec() is called and migrate remote_debugger_script to cpython.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 asyncio debugging tools to properly display internal coroutine call stacks alongside external task dependencies. The python -m asyncio ps and python -m asyncio pstree commands now show complete execution context. Patch by Pablo Galindo.

  • gh-135422: Fix regression in SyntaxError messages after gh-134036.

Library

  • gh-116738: Make functions in grp thread-safe on the free threaded build.

  • gh-127319: Set the allow_reuse_port class variable to False on 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_NEGATIVE in 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_INVERT in JIT-compiled code.

  • gh-131798: Optimize away _CALL_TYPE_1 in the JIT when the return type is known. Patch by Tomas Roun

  • gh-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_VERSION into _CHECK_FUNCTION_VERSION_INLINE in JIT-compiled code.

Library

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

Core and Builtins

  • gh-117852: Fix argument checking of athrow().

  • 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_TUPLE ops.

  • 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_GenericSetDict to 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

Core and Builtins

  • gh-127960: PyREPL interactive shell no longer starts with __package__ and __file__ global names set to _pyrepl package 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_INT with _LOAD_CONST_INLINE_BORROW

  • gh-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_BORROW and use it to further optimize CALL_ISINSTANCE.

  • gh-131798: Split CALL_LIST_APPEND into 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 bytearray is 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.modules after its initial import. Patch by Nico-Posada.

  • gh-134036: Improve SyntaxError message when using invalid raise statements.

  • gh-133999: Fix SyntaxError regression in except parsing 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 under from __future__ import annotations had 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 ValueError when constants True, False or None are used as an identifier after NFKC normalization.

  • gh-131798: Allow the JIT to remove int guards after _GET_LEN by setting the return type to int.

  • gh-131798: Split CALL_ISINSTANCE into 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, NULL is 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_ISINSTANCE for a subset of known values in the JIT. Patch by Tomas Roun

  • gh-132542: Update Thread.native_id after 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 using del obj.attr if attr does not exist.

  • gh-128640: Fix a crash when using threads inside of a subinterpreter.

Library

  • gh-116738: Make the module json safe to use under the free-threading build.

Core and Builtins

  • gh-119494: Exception text when trying to delete attributes of types was clarified.

C API

Build

  • gh-138489: When cross-compiling for WASI by build_wasm or build_emscripten, the build-details.json step is now included in the build process, just like with native builds.

    This fixes the libinstall task which requires the build-details.json file during the process.

  • gh-138497: The LLVM version used by the JIT at build time can now be modified using the LLVM_VERSION environment variable. Use this at your own risk, as there is only one officially supported LLVM version. For more information, please check Tools/jit/README.md.

  • gh-95952: When cross-compiling for WASI, require that the HOSTRUNNER environment variable be explicitly set.

    This was needed as macOS lacks the appropriate CLI tools to set a reasonable default.

  • gh-138061: Ensure reproducible builds by making JIT stencil header generation deterministic.

  • gh-128042: ./configure now warns when --enable-optimizations and CFLAGS=-O0 are both set, suggesting removing -O0 from CFLAGS for optimal performance. Patch by Taegyun Kim.

  • gh-132339: Add support for OpenSSL 3.5.

  • gh-135621: PyREPL no longer depends on the curses standard library. Contributed by Łukasz Langa.

  • gh-135927: Fix building with MSVC when passing option /std:clatest.

  • gh-119132: Remove “experimental” tag from the CPython free-threading build.

  • gh-135497: Fix the detection of MAXLOGNAME in the configure.ac script.

  • gh-134923: Windows builds with profile-guided optimization enabled now use /GENPROFILE and /USEPROFILE instead of deprecated /LTCG: options.

  • gh-134632: Fixed build-details.json generation to use INCLUDEPY, in order to reference the pythonX.Y subdirectory of the include directory, as required in PEP 739, instead of the top-level include directory.

  • gh-134486: The ctypes module now performs a more portable test for the definition of alloca(3), fixing a compilation failure on NetBSD.

  • gh-134455: Fixed build-details.json generation to use the correct c_api.headers as defined in PEP 739, instead of c_api.include.

  • gh-134273: Add support for configuring compiler flags for the JIT with CFLAGS_JIT

  • gh-115119: Removed implicit fallback to the bundled copy of the libmpdec library. Now this should be explicitly enabled via --with-system-libmpdec set to no or --without-system-libmpdec. Patch by Sergey B Kirpichev.

  • gh-131769: Fix detecting when the build Python in a cross-build is a pydebug build.

  • gh-117088: AIX linker don’t support -h option, so avoid it through platform check

  • gh-123681: Check the strftime() behavior at runtime instead of at the compile time to support cross-compiling. Remove the internal macro _Py_NORMALIZE_CENTURY.

  • gh-127545: Fix crash when building on Linux/m68k.

Python 3.14.0 beta 1

Release date: 2025-05-06

Windows

Tools/Demos

  • gh-130453: Allow passing multiple keyword arguments with the same function name in pygettext.

  • gh-130195: Add warning messages when pygettext unimplemented -a/--extract-all option is called.

Tests

  • gh-133131: The iOS testbed will now select the most recently released “SE-class” device for testing if a device isn’t explicitly specified.

  • gh-91048: Add ability to externally inspect all pending asyncio tasks, even if no task is currently entered on the event loop.

  • gh-109981: The test helper that counts the list of open file descriptors now uses the optimised /dev/fd approach on all Apple platforms, not just macOS. This avoids crashes caused by guarded file descriptors.

  • gh-132678: Add --prioritize to -m test. This option allows the user to specify which selected tests should execute first, even if the order is otherwise randomized. This is particularly useful for tests that run the longest.

  • gh-131290: Tests in Lib/test can now be correctly executed as standalone scripts.

Security

  • gh-115322: The underlying extension modules behind readline:, subprocess, and ctypes now raise audit events on previously uncovered code paths that could lead to file system access related to C function calling and external binary execution. The ctypes.call_function audit hook has also been fixed to use an unsigned value for its function pointer.

Library

IDLE

  • gh-112936: fix IDLE: no Shell menu item in single-process mode.

Documentation

  • gh-107006: Move documentation and example code for threading.local from its docstring to the official docs.

  • gh-125142: As part of the builtin help intro text, show the keyboard shortcuts for the new, non-basic REPL (F1, F2, and F3).

Core and Builtins

  • gh-133336: -J is no longer reserved for use by Jython. Patch by Adam Turner.

  • gh-133261: Fix bug where the cycle GC could untrack objects in the trashcan because they looked like they were immortal. When objects are added to the trashcan, we take care to ensure they keep a mortal reference count.

  • gh-133346: Added experimental color theming support to the _colorize module.

  • gh-132917: For the free-threaded build, check the process memory usage increase before triggering a full automatic garbage collection. If the memory used has not increased 10% since the last collection then defer it.

  • gh-91048: Add a new python -m asyncio ps PID command-line interface to inspect asyncio tasks in a running Python process. Displays a flat table of await relationships. A variant showing a tree view is also available as python -m asyncio pstree PID. Both are useful for debugging async code. Patch by Pablo Galindo, Łukasz Langa, Yury Selivanov, and Marta Gomez Macias.

  • gh-133304: Workaround NaN’s “canonicalization” in PyFloat_Pack4() and PyFloat_Unpack4() on RISC-V.

  • gh-133197: Improve SyntaxError error messages for incompatible string / bytes prefixes.

  • gh-133231: Add new utilities of observing JIT compilation: sys._jit.is_available(), sys._jit.is_enabled(), and sys._jit.is_active().

Library

Core and Builtins

  • gh-131798: Split CALL_LEN into several uops allowing the JIT to remove them when optimizing. Patch by Diego Russo.

  • gh-131798: Use sym_new_type instead of sym_new_not_null for _BUILD_STRING, _BUILD_SET

  • gh-132942: Fix two races in the type lookup cache. This affected the free-threaded build and could cause crashes (apparently quite difficult to trigger).

  • gh-131798: Propagate the return type of _BINARY_OP_SUBSCR_TUPLE_INT in JIT. Patch by Tomas Roun

  • gh-132952: Speed up startup with the -S argument by importing the private _io module instead of io. This fixes a performance regression introduced earlier in Python 3.14 development and restores performance to the level of Python 3.13.

  • gh-131798: Allow the JIT to remove int guards after _CALL_LEN by setting the return type to int. Patch by Diego Russo

  • gh-131798: Split CALL_TUPLE_1 into several uops allowing the JIT to remove some of them. Patch by Tomas Roun

  • gh-131798: Split CALL_STR_1 into several uops allowing the JIT to remove some of them. Patch by Tomas Roun

  • gh-132825: Enhance unhashable key/element error messages for dict and set. Patch by Victor Stinner.

  • gh-131591: Reset any PEP 768 remote debugging pending call in children after os.fork() calls.

  • gh-132713: Fix repr(list) race condition: hold a strong reference to the item while calling repr(item). Patch by Victor Stinner.

  • gh-132661: Implement PEP 750 (Template Strings). Add new syntax for t-strings and implement new internal string.templatelib.Template and string.templatelib.Interpolation types.

  • gh-132479: Fix compiler crash in certain circumstances where multiple module-level annotations include comprehensions and other nested scopes.

  • gh-132747: Fix a crash when calling __get__() of a method with a None second argument.

  • gh-132744: Certain calls now check for runaway recursion and respect the system recursion limit.

  • gh-132449: Syntax errors that look like misspellings of Python keywords now provide a helpful fix suggestion for the typo. Contributed by Pablo Galindo Salgado.

Library

  • gh-132737: Support profiling code that requires __main__, such as pickle.

Core and Builtins

  • gh-132639: Added PyLong_AsNativeBytes(), PyLong_FromNativeBytes() and PyLong_FromUnsignedNativeBytes() to the limited C API.

  • gh-100239: Add specialisation for BINARY_OP/SUBSCR on list and slice.

  • gh-132508: Uses tagged integers on the evaluation stack to represent the instruction offsets when reraising an exception. This avoids the need to box the integer which could fail in low memory conditions.

  • gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale.

  • gh-131927: Compiler warnings originating from the same module and line number are now only emitted once, matching the behaviour of warnings emitted from user code. This can also be configured with warnings filters.

  • gh-132457: Make staticmethod() and classmethod() generic.

  • gh-131798: Use sym_new_type instead of sym_new_not_null for _BUILD_LIST, _BUILD_SET, _BUILD_MAP

  • gh-131798: Split CALL_TYPE_1 into several uops allowing the JIT to remove some of them.

  • gh-132386: Fix crash when passing a dict subclass as the globals parameter to exec().

  • gh-127682: No longer call __iter__ twice when creating and executing a generator expression. Creating a generator expression from a non-interable will raise only when the generator expression is executed. This brings the behavior of generator expressions in line with other generators.

  • gh-132261: The internal storage for annotations and annotate functions on classes now uses different keys in the class dictionary. This eliminates various edge cases where access to the __annotate__ and __annotations__ attributes would behave unpredictably.

  • gh-132284: Don’t wrap base PyCFunction slots on class creation if not overridden.

  • gh-130415: Improve the JIT’s ability to remove unused constant and local variable loads, and fix an issue where deallocating unused values could cause JIT code to crash or behave incorrectly.

  • gh-126703: Fix possible use after free in cases where a method’s definition has the same lifetime as its self.

  • gh-132286: Fix that type.__annotate__ was not deleted, when type.__annotations__ was deleted.

  • gh-131798: Allow the JIT to remove an extra _TO_BOOL_BOOL instruction after _CONTAINS_OP_DICT by setting the return type to bool.

  • gh-124715: Prevents against stack overflows when calling Py_DECREF(). Third-party extension objects no longer need to use the “trashcan” mechanism, as protection is now built into the Py_DECREF() macro.

  • gh-131798: Allow the JIT compiler to remove some type checks for operations on lists, tuples, dictionaries, and sets.

  • gh-128398: Improve error message when an object supporting the synchronous (resp. asynchronous) context manager protocol is entered using async with (resp. with) instead of with (resp. async with). Patch by Bénédikt Tran.

  • gh-131798: Allow the JIT to remove unicode guards after _BINARY_OP_SUBSCR_STR_INT by setting the return type to string.

  • gh-131878: Handle uncaught exceptions in the main input loop for the new REPL.

  • gh-131878: Fix support of unicode characters with two or more codepoints on Windows in the new REPL.

  • gh-126835: Move constant folding to the peephole optimizer. Rename AST optimization related files (Python/ast_opt.c -> Python/ast_preprocess.c), structs (_PyASTOptimizeState -> _PyASTPreprocessState) and functions (_PyAST_Optimize -> _PyAST_Preprocess, _PyCompile_AstOptimize -> _PyCompile_AstPreprocess).

  • gh-114809: Add support for macOS multi-arch builds with the JIT enabled

  • gh-131507: PyREPL now supports syntax highlighting. Contributed by Łukasz Langa.

  • gh-130907: If the __annotations__ of a module object are accessed while the module is executing, return the annotations that have been defined so far, without caching them.

  • gh-130104: Three-argument pow() now try calling __rpow__() if necessary. Previously it was only called in two-argument pow() and the binary power operator.

  • gh-130070: Fixed an assertion error for exec() passed a string source and a non-None closure. Patch by Bartosz Sławecki.

  • gh-129958: Fix a bug that was allowing newlines inconsistently in format specifiers for single-quoted f-strings. Patch by Pablo Galindo.

  • gh-129858: elif statements that follow an else block now have a specific error message.

  • gh-69605: Add module autocomplete to PyREPL.

  • gh-128555: Add the sys.flags.thread_inherit_context flag.

  • gh-123539: Improve SyntaxError message for using import ... as and from ... import ... as with not a name.

  • gh-102567: -X importtime now accepts value 2, which indicates that an importtime entry should also be printed if an imported module has already been loaded. Patch by Noah Kim and Adam Turner.

  • gh-116436: Improve error message when TypeError occurs during dict.update()

  • gh-103997: String arguments passed to “-c” are now automatically dedented. This allows “python -c” invocations to be indented in shell scripts without causing indentation errors. (Patch by Jon Crall and Steven Sun)

Library

  • gh-89562: Remove hostflags member from PySSLContext struct.

C API

Build

  • gh-113464: Use the cpython-bin-deps “externals” repository for Windows LLVM dependency management. Installing LLVM manually is no longer necessary for Windows JIT builds.

  • gh-133183: iOS compiler shims now include IPHONEOS_DEPLOYMENT_TARGET in target triples, ensuring that SDK version minimums are honored.

  • gh-133167: Fix compilation process with --enable-optimizations and --without-docstrings.

  • gh-133171: Since free-threaded builds do not support the experimental JIT compiler, prevent these configurations from being combined.

  • gh-132758: Fix building with tail call interpreter and pystats.

  • gh-132649: The PClayout script now allows passing --include-tcltk on Windows ARM64.

  • gh-132257: Change the default LTO flags on GCC to not pass -flto-partition=none, and allow parallelization of LTO. For newer GNU makes and GCC, this has a multiple factor speedup for LTO build times, with no noticeable loss in performance.

  • gh-132026: Fix use of undefined identifiers in platform triplet detection on MIPS Linux platforms.

Python 3.14.0 alpha 7

Release date: 2025-04-08

macOS

  • gh-124111: Update macOS installer to use Tcl/Tk 8.6.16.

  • gh-131423: Update macOS installer to use OpenSSL 3.0.16. Patch by Bénédikt Tran.

  • gh-131025: Update macOS installer to ship with SQLite 3.49.1.

Windows

  • gh-131423: Update bundled version of OpenSSL to 3.0.16. The new build also disables uplink support, which may be relevant to embedders but has no impact on normal use.

  • gh-131453: Some SND_* and MB_* constants are added to winsound.

  • gh-91349: Replaces our copy of zlib with zlib-ng, for performance improvements in zlib.

  • gh-131025: Update Windows installer to ship with SQLite 3.49.1.

Tools/Demos

  • gh-132121: Always escape non-printable Unicode characters in pygettext.

  • gh-131852: msgfmt no longer adds the POT-Creation-Date to generated .mo files for consistency with GNU msgfmt.

Tests

  • gh-131277: Allow to unset one or more environment variables at once via EnvironmentVarGuard.unset(). Patch by Bénédikt Tran.

  • gh-131050: test_ssl.test_dh_params is skipped if the underlying TLS library does not support finite-field ephemeral Diffie-Hellman.

Security

  • gh-131809: Update bundled libexpat to 2.7.1

  • gh-131261: Upgrade to libexpat 2.7.0

  • gh-121284: Fix bug in the folding of rfc2047 encoded-words when flattening an email message using a modern email policy. Previously when an encoded-word was too long for a line, it would be decoded, split across lines, and re-encoded. But commas and other special characters in the original text could be left unencoded and unquoted. This could theoretically be used to spoof header lines using a carefully constructed encoded-word if the resulting rendered email was transmitted or re-parsed.

Library

Documentation

Core and Builtins

  • gh-131798: Allow the JIT to remove an extra _TO_BOOL_BOOL instruction after _CONTAINS_OP_SET by setting the return type to bool.

  • gh-132011: Fix crash when calling list.append() as an unbound method.

  • gh-131998: Fix a crash when using an unbound method descriptor object in a function where a bound method descriptor was used.

  • gh-131591: Implement PEP 768 (Safe external debugger interface for CPython). Add a new sys.remote_exec() function to the sys module. This function schedules the execution of a Python file in a separate process. Patch by Pablo Galindo, Matt Wozniski and Ivona Stojanovic.

  • gh-131798: Allow JIT to omit str guard in truthiness test when str type is known.

  • gh-131833: Add support for optionally dropping grouping parentheses when using multiple exception types as per PEP 758. Patch by Pablo Galindo

  • gh-130924: Usage of a name in a function-scope annotation no longer triggers creation of a cell for that variable. This fixes a regression in earlier alphas of Python 3.14.

  • gh-131800: Improve the experimental JIT’s ability to remove type checks for certain subscripting operations.

  • gh-131738: Compiler emits optimized code for builtin any/all/tuple calls over a generator expression.

  • gh-131719: Fix missing NULL check in _PyMem_FreeDelayed in free-threaded build.

  • gh-131670: Fix anext() failing on sync __anext__() raising an exception.

  • gh-131666: Fix signature of anext_awaitable.close objects. Patch by Bénédikt Tran.

  • gh-130415: Optimize comparison of two constants in JIT builds

  • gh-129149: Add fast path for small and medium-size integers in PyLong_FromInt32(), PyLong_FromUInt32(), PyLong_FromInt64() and PyLong_FromUInt64(). Patch by Chris Eibl.

  • gh-130887: Optimize the AArch64 code generation for the JIT. Patch by Diego Russo

  • gh-130956: Optimize the AArch64 code generation for the JIT. Patch by Diego Russo

  • gh-130928: Fix error message when formatting bytes using the 'i' flag. Patch by Maxim Ageev.

  • gh-130935: Annotations at the class and module level that are conditionally defined are now only reflected in __annotations__ if the block they are in is executed. Patch by Jelle Zijlstra.

  • gh-130775: Do not crash on negative column and end_column in ast locations.

  • gh-130704: Optimize LOAD_FAST and its superinstruction form to reduce reference counting overhead. These instructions are replaced with faster variants that load borrowed references onto the operand stack when we can prove that the reference in the frame outlives the reference loaded onto the stack.

  • gh-88887: Fixing multiprocessing Resource Tracker process leaking, usually observed when running Python as PID 1.

  • gh-130115: Fix an issue with thread identifiers being sign-extended on some platforms.

Library

  • gh-99108: Add support for built-in implementation of HMAC (RFC 2104) based on HACL*. Patch by Bénédikt Tran.

Core and Builtins

  • gh-130080: Implement PEP 765: Disallow return/break/continue that exit a finally block.

  • gh-129900: Fix return codes inside SystemExit not getting returned by the REPL.

  • gh-128632: Disallow __classdict__ as the name of a type parameter. Using this name would previously crash the interpreter in some circumstances.

  • gh-126703: Improve performance of builtin methods by using a freelist.

  • gh-126703: Improve performance of range by using a freelist.

C API

  • gh-131740: Update PyUnstable_GC_VisitObjects to traverse perm gen.

  • gh-131525: The PyTupleObject now caches the computed hash value in the new field ob_hash.

Build

  • gh-131865: The DTrace build now properly passes the CC and CFLAGS variables to the dtrace command when utilizing SystemTap on Linux.

  • gh-131675: Fix mimalloc library builds for 32-bit ARM targets.

  • gh-131691: clang-cl on Windows needs option /EHa to support SEH (structured exception handling) correctly. Fix by Chris Eibl.

  • gh-131278: Add optimizing flag WITH_COMPUTED_GOTOS to Windows builds for when using a compiler that supports it (currently clang-cl). Patch by Chris Eibl.

  • gh-130213: Update the vendored HACL* library to fix build issues with older clang compilers.

  • gh-130673: Fix potential KeyError when handling object sections during JIT building process.

Python 3.14.0 alpha 6

Release date: 2025-03-14

macOS

Windows

  • gh-131020: pylauncher correctly detects a BOM when searching for the shebang. Fix by Chris Eibl.

Tools/Demos

  • gh-130453: Make it possible to override default keywords in pygettext.

  • gh-85012: Correctly reset msgctxt when compiling messages in msgfmt.

  • gh-130453: Extend support for specifying custom keywords in pygettext.

  • gh-130195: Add warning messages when pygettext unimplemented -a/--extract-all option is called.

  • gh-130057: Add support for translator comments in pygettext.py.

  • gh-130025: The iOS testbed now correctly handles symlinks used as Python framework references.

  • gh-129911: Fix the keyword entry in the help output of pygettext.

Tests

  • gh-129200: Multiple iOS testbed runners can now be started at the same time without introducing an ambiguity over simulator ownership.

  • gh-130292: The iOS testbed will now run successfully on a machine that has not previously run Xcode tests (such as CI configurations).

  • gh-130293: The tests of terminal colorization are no longer sensitive to the value of the TERM variable in the testing environment.

  • gh-129401: Fix a flaky test in test_repr_rlock that checks the representation of multiprocessing.RLock.

  • gh-126332: Add unit tests for pyrepl.

Security

  • gh-127371: Avoid unbounded buffering for tempfile.SpooledTemporaryFile.writelines(). Previously, disk spillover was only checked after the lines iterator had been exhausted. This is now done after each line is written.

Library

Documentation

Core and Builtins

  • gh-131141: Fix data race in sys.monitoring instrumentation while registering callback.

  • gh-130804: Fix support of unicode characters on Windows in the new REPL.

  • gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing

  • gh-122029: sys.setprofile() and sys.settrace() will not generate a c_call event for INSTRUMENTED_CALL_FUNCTION_EX if the callable is a method with a C function wrapped, because we do not generate c_return event in such case.

  • gh-129964: Fix JIT crash on Windows on Arm. Patch by Diego Russo and Brandt Bucher.

  • gh-130851: Fix a crash in the free threading build when constructing a code object with co_consts that contains instances of types that are not otherwise generated by the bytecode compiler.

  • gh-128534: Ensure that both left and right branches have the same source for async for loops. Add these branches to the co_branches() iterator.

  • gh-130794: Fix memory leak in the free threaded build when resizing a shared list or dictionary from multiple short-lived threads.

  • gh-130415: Improve JIT understanding of integers in boolean context.

  • gh-130382: Fix PyRefTracer_DESTROY not being sent from Python/ceval.c Py_DECREF().

  • gh-130574: Renumber RESUME from 149 to 128.

  • gh-124878: Fix race conditions during runtime finalization that could lead to accessing freed memory.

  • gh-130415: Improve the experimental JIT’s ability to narrow boolean values based on the results of truthiness tests.

  • gh-130618: Fix a bug that was causing UnicodeDecodeError or SystemError to be raised when using f-strings with lambda expressions with non-ASCII characters. Patch by Pablo Galindo

  • gh-123044: Make sure that the location of branch targets in match cases is in the body, not the pattern.

  • gh-128534: Add branch monitoring (BRANCH_LEFT and BRANCH_RIGHT events) for async for loops.

  • gh-130163: Fix possible crashes related to concurrent change and use of the sys module attributes.

  • gh-122029: INSTRUMENTED_CALL_KW will expand the method before monitoring to reflect the actual behavior more accurately.

  • gh-130415: Improve JIT’s ability to optimize strings in boolean contexts.

  • gh-130396: Use actual stack limits (from pthread_getattr_np(3)) for linux, and other systems with _GNU_SOURCE defined, when determining limits for C stack protection.

  • gh-128396: Fix a crash that occurs when calling locals() inside an inline comprehension that uses the same local variable as the outer frame scope where the variable is a free or cell var.

  • gh-129107: Fix two more bytearray functions for free threading.

  • gh-127705: Use tagged references (_PyStackRef) for the default build as well as for the free-threading build. This has a small negative performance impact short-term but will enable larger speedups in the future and significantly reduce maintenance costs by allowing a single implementation of tagged references in the future.

  • gh-130094: Fix two race conditions involving concurrent imports that could lead to spurious failures with ModuleNotFoundError.

  • gh-129107: Make bytearray iterator safe under free threading.

  • gh-115802: Use the more efficient “medium” code model for JIT-compiled code on supported platforms.

  • gh-107956: A build-details.json file is now install in the platform-independent standard library directory (PEP 739 implementation).

  • gh-116042: Fix location for SyntaxErrors of invalid escapes in the tokenizer. Patch by Pablo Galindo

  • gh-91079: Change C stack overflow protection to consider the amount of stack consumed, rather than a counter. This allows deeper recursion in many cases, but remains safe.

  • gh-129715: Improve the experimental JIT’s handling of returns to unknown callers.

Library

  • gh-129983: Fix data race in compile_template in sre.c.

Core and Builtins

  • gh-129967: Fix a race condition in the free threading build when repr(set) is called concurrently with set.clear().

  • gh-129953: The internal (evaluation) stack is now spilled to memory whenever execution escapes from the interpreter or JIT compiled code. This should have no observable effect in either Python or builtin extensions, but will allow various important optimizations in the future.

  • gh-129515: Clarify syntax error messages for conditional expressions when a statement is specified before an if or after an else keyword.

  • gh-129349: bytes.fromhex() and bytearray.fromhex() now accepts ASCII bytes and bytes-like objects.

  • gh-129149: Add fast path for medium-size integers in PyLong_FromSsize_t(). Patch by Chris Eibl.

  • gh-129107: Make the bytearray safe under free threading.

  • gh-128974: Fix a crash in UnicodeError.__str__ when custom attributes implement __str__() with side-effects. Patch by Bénédikt Tran.

  • gh-126085: typing.TypeAliasType now supports star unpacking.

  • gh-125331: from __future__ import barry_as_FLUFL now works in more contexts, including when it is used in files, with the -c flag, and in the REPL when there are multiple statements on the same line. Previously, it worked only on subsequent lines in the REPL, and when the appropriate flags were passed directly to compile(). Patch by Pablo Galindo.

  • gh-121464: Make concurrent iterations over the same enumerate() iterator safe under free-threading. See Strategy for Iterators in Free Threading.

  • gh-87790: Support underscore and comma as thousands separators in the fractional part for floating-point presentation types of the new-style string formatting (with format() or f-strings). Patch by Sergey B Kirpichev.

  • gh-124445: Fix specialization of generic aliases that are generic over a typing.ParamSpec and have been specialized with a nested type variable.

  • gh-120608: Adapt reversed() for use in the free-threading build. The reversed() is still not thread-safe in the sense that concurrent iterations may see the same object, but they will not corrupt the interpreter state.

Library

  • gh-100388: Fix the platform._sys_version() method when __DATE__ is undefined at buildtime by changing default buildtime datetime string to the UNIX epoch.

Core and Builtins

  • bpo-44369: Improve syntax errors for incorrectly closed strings. Patch by Pablo Galindo

C API

Build

  • gh-131035: Use -flto=thin for faster build times using clang-cl on Windows. Patch by Chris Eibl.

  • gh-130740: Ensure that Python.h is included before stdbool.h unless pyconfig.h is included before or in some platform-specific contexts.

  • gh-130090: Building with PlatformToolset=ClangCL on Windows now supports PGO (profile guided optimization). Patch by Chris Eibl with invaluable support from Steve Dover.

  • gh-129819: Allow building the JIT with the tailcall interpreter.

  • gh-129989: Fix a bug where the tailcall interpreter was enabled when --without-tail-call-interp was provided to the configure script.

  • gh-129838: Don’t redefine _Py_NO_SANITIZE_UNDEFINED when compiling with a recent GCC version and undefined sanitizer enabled.

  • gh-82909: #pragma-based linking with python3*.lib can now be switched off with Py_NO_LINK_LIB. Patch by Jean-Christophe Fillion-Robin.

Python 3.14.0 alpha 5

Release date: 2025-02-11

macOS

  • gh-91132: Update macOS installer to use ncurses 6.5.

Tools/Demos

  • gh-129248: The iOS test runner now strips the log prefix from each line output by the test suite.

  • gh-104400: Fix several bugs in extraction by switching to an AST parser in pygettext.

Tests

  • gh-129386: Add test.support.reset_code, which can be used to reset various bytecode-level optimizations and local instrumentation for a function.

  • gh-128474: Disable test_embed test cases that segfault on BOLT instrument binaries. The tests are only disabled when BOLT is enabled.

  • gh-128003: Add an option --parallel-threads=N to the regression test runner that runs individual tests in multiple threads in parallel in order to find concurrency bugs. Note that most of the test suite is not yet reviewed for thread-safety or annotated with @thread_unsafe when necessary.

Security

  • gh-105704: When using urllib.parse.urlsplit() and urllib.parse.urlparse() host parsing would not reject domain names containing square brackets ([ and ]). Square brackets are only valid for IPv6 and IPvFuture hosts according to RFC 3986 Section 3.2.2.

  • gh-126108: Fix a possible NULL pointer dereference in PySys_AddWarnOptionUnicode().

  • gh-80222: Fix bug in the folding of quoted strings when flattening an email message using a modern email policy. Previously when a quoted string was folded so that it spanned more than one line, the surrounding quotes and internal escapes would be omitted. This could theoretically be used to spoof header lines using a carefully constructed quoted string if the resulting rendered email was transmitted or re-parsed.

  • gh-119511: Fix a potential denial of service in the imaplib module. When connecting to a malicious server, it could cause an arbitrary amount of memory to be allocated. On many systems this is harmless as unused virtual memory is only a mapping, but if this hit a virtual address size limit it could lead to a MemoryError or other process crash. On unusual systems or builds where all allocated memory is touched and backed by actual ram or storage it could’ve consumed resources doing so until similarly crashing.

Library

IDLE

  • gh-129873: Simplify displaying the IDLE doc by only copying the text section of idle.html to idlelib/help.html. Patch by Stan Ulbrych.

Documentation

Core and Builtins

  • gh-100239: Replace the opcode BINARY_SUBSCR and its family by BINARY_OP with oparg NB_SUBSCR.

  • gh-129732: Fixed a race in _Py_qsbr_reserve in the free threading build.

  • gh-129763: Remove the internal LLTRACE macro (use Py_DEBUG instead).

  • gh-129715: Improve JIT performance for generators.

  • gh-129643: Fix thread safety of PyList_Insert() in free-threading builds.

  • gh-129668: Fix race condition when raising MemoryError in the free threaded build.

  • gh-129643: Fix thread safety of PyList_SetItem() in free-threading builds. Patch by Kumar Aditya.

  • gh-128563: Fix an issue where the “lltrace” debug feature could have been incorrectly enabled for some frames.

  • gh-129393: On FreeBSD, sys.platform doesn’t contain the major version anymore. It is always 'freebsd', instead of 'freebsd13' or 'freebsd14'.

Library

Core and Builtins

  • gh-129231: Improve memory layout of JIT traces. Patch by Diego Russo

  • gh-129149: Add fast path for medium-size integers in PyLong_FromUnsignedLong(), PyLong_FromUnsignedLongLong() and PyLong_FromSize_t().

  • gh-129201: The free-threaded version of the cyclic garbage collector has been optimized to conditionally use CPU prefetch instructions during the collection. This can reduce collection times by making it more likely that data is in the CPU cache when it is needed. The prefetch instructions are enabled if the number of long-lived objects (objects surviving a full collection) exceeds a threshold.

  • gh-129093: Fix f-strings such as f'{expr=}' sometimes not displaying the full expression when the expression contains !=.

  • gh-124363: Treat debug expressions in f-string as raw strings. Patch by Pablo Galindo

  • gh-128714: Fix the potential races in get/set dunder methods __annotations__, __annotate__ and __type_params__ for function object, and add related tests.

  • gh-128799: Add frame of except* to traceback when it wraps a naked exception.

  • gh-128842: Collect JIT memory stats using pystats. Patch by Diego Russo.

  • gh-100239: Specialize BINARY_OP for bitwise logical operations on compact ints.

  • gh-128910: Undocumented and unused private C-API functions _PyTrash_begin and _PyTrash_end are removed.

  • gh-128807: Add a marking phase to the free-threaded GC. This is similar to what was done in gh-126491. Since the free-threaded GC does not have generations and is not incremental, the marking phase looks for all objects reachable from known roots. The roots are objects known to not be garbage, like the module dictionary for sys. For most programs, this marking phase should make the GC a bit faster since typically less work is done per object.

  • gh-100239: Add opcode BINARY_OP_EXTEND which executes a pair of functions (guard and specialization functions) accessed from the inline cache.

  • gh-128563: A new type of interpreter has been added to CPython. This interpreter uses tail calls for its instruction handlers. Preliminary benchmark results suggest 7-11% geometric mean faster on pyperformance (depending on platform), and up to 30% faster on Python-intensive workloads. This interpreter currently only works on newer compilers, such as clang-19. Other compilers will continue using the old interpreter. Patch by Ken Jin, with ideas on how to implement this in CPython by Mark Shannon, Garret Gu, Haoran Xu, and Josh Haberman.

  • gh-126703: Improve performance of iterating over lists and tuples by using a freelist for the iterator objects.

  • gh-127953: The time to handle a LINE event in sys.monitoring (and sys.settrace) is now independent of the number of lines in the code object.

  • gh-128330: Restore terminal control characters on REPL exit.

  • gh-128016: Improved the SyntaxWarning message for invalid escape sequences to clarify that such sequences will raise a SyntaxError in future Python releases. The new message also suggests a potential fix, i.e., Did you mean "\\e"?.

  • gh-126004: Fix handling of UnicodeError.start and UnicodeError.end values in the codecs.replace_errors() error handler. Patch by Bénédikt Tran.

  • gh-126004: Fix handling of UnicodeError.start and UnicodeError.end values in the codecs.backslashreplace_errors() error handler. Patch by Bénédikt Tran.

  • gh-126004: Fix handling of UnicodeError.start and UnicodeError.end values in the codecs.xmlcharrefreplace_errors() error handler. Patch by Bénédikt Tran.

  • gh-127119: Slightly optimize the int deallocator.

  • gh-127349: Fixed the error when resizing terminal in Python REPL. Patch by Semyon Moroz.

  • gh-125723: Fix crash with gi_frame.f_locals when generator frames outlive their generator. Patch by Mikhail Efimov.

Library

Core and Builtins

  • gh-115911: If the current working directory cannot be determined due to permissions, then import will no longer raise PermissionError. Patch by Alex Willmer.

Library

C API

Build

  • gh-129660: Drop test_embed from PGO training, whose contribution in recent versions is considered to be ignorable.

  • gh-128902: Fix compile errors with Clang 9 and older due to lack of __attribute__((fallthrough)) support.

Python 3.14.0 alpha 4

Release date: 2025-01-14

macOS

  • gh-127592: Usage of the unified Apple System Log APIs was disabled when the minimum macOS version is earlier than 10.12.

Tools/Demos

  • gh-128152: Fix a bug where Argument Clinic’s C pre-processor parser tried to parse pre-processor directives inside C comments. Patch by Erlend Aasland.

Tests

  • gh-128690: Temporarily do not use test_embed in PGO profile builds until the problem with test_init_pyvenv_cfg failing in some configurations is resolved.

Library

Core and Builtins

  • gh-128078: Fix a SystemError when using anext() with a default tuple value. Patch by Bénédikt Tran.

  • gh-128717: Fix a crash when setting the recursion limit while other threads are active on the free threaded build.

  • gh-124483: Treat Py_DECREF and variants as escaping when generating opcode and uop metadata. This prevents the possibility of a __del__ method causing the JIT to behave incorrectly.

  • gh-126703: Improve performance of class methods by using a freelist.

  • gh-128137: Update PyASCIIObject layout to handle interned field with the atomic operation. Patch by Donghee Na.

Library

Core and Builtins

  • gh-126868: Increase usage of freelist for int allocation.

  • gh-114203: Optimize Py_BEGIN_CRITICAL_SECTION for simple recursive calls.

  • gh-127705: Adds stackref debugging when Py_STACKREF_DEBUG is set. Finds all double-closes and leaks, logging the origin and last borrow.

    Inspired by HPy’s debug mode. https://docs.hpyproject.org/en/latest/debug-mode.html

  • gh-128079: Fix a bug where except* does not properly check the return value of an ExceptionGroup’s split() function, leading to a crash in some cases. Now when split() returns an invalid object, except* raises a TypeError with the original raised ExceptionGroup object chained to it.

  • gh-128030: Avoid error from calling PyModule_GetFilenameObject on a non-module object when importing a non-existent symbol from a non-module object.

Library

  • gh-128035: Indicate through ssl.HAS_PHA whether the ssl module supports TLSv1.3 post-handshake client authentication (PHA). Patch by Will Childs-Klein.

Core and Builtins

  • gh-127274: Add a new flag, CO_METHOD, to co_flags that indicates whether the code object belongs to a function defined in class scope.

  • gh-66409: During the path initialization, we now check if base_exec_prefix is the same as base_prefix before falling back to searching the Python interpreter directory.

  • gh-127970: We now use the location of the libpython runtime library used in the current process to determine sys.base_prefix on all platforms implementing the dladdr function defined by the UNIX standard — this includes Linux, Android, macOS, iOS, FreeBSD, etc. This was already the case on Windows and macOS Framework builds.

  • gh-127773: Do not use the type attribute cache for types with incompatible MRO.

  • gh-127903: Objects/unicodeobject.c: fix a crash on DEBUG builds in _copy_characters when there is nothing to copy.

  • gh-127809: Fix an issue where the experimental JIT may infer an incorrect result type for exponentiation (** and **=), leading to bugs or crashes.

  • gh-126862: Fix a possible overflow when a class inherits from an absurd number of super-classes. Reported by Valery Fedorenko. Patch by Bénédikt Tran.

C API

Build

  • gh-128627: For Emscripten builds the function pointer cast call trampoline now uses the wasm-gc ref.test instruction if it’s available instead of Wasm JS type reflection.

  • gh-128472: Skip BOLT optimization of functions using computed gotos, fixing errors on build with LLVM 19.

  • gh-115765: GNU Autoconf 2.72 is now required to generate configure. Patch by Erlend Aasland.

  • gh-123925: Fix building the curses module on platforms with libncurses but without libncursesw.

  • gh-90905: Add support for cross-compiling to x86_64 on aarch64/arm64 macOS.

  • gh-128321: Set LIBS instead of LDFLAGS when checking if sqlite3 library functions are available. This fixes the ordering of linked libraries during checks, which was incorrect when using a statically linked libsqlite3.

  • gh-100384: Error on unguarded-availability in macOS builds, preventing invalid use of symbols that are not available in older versions of the OS.

  • gh-128104: Remove Py_STRFTIME_C99_SUPPORT conditions in favor of requiring C99 strftime(3) specifier support at build time. When cross-compiling, there is no build time check and support is assumed.

  • gh-127951: Add option --pystats to the Windows build to enable performance statistics collection.

Python 3.14.0 alpha 3

Release date: 2024-12-17

Windows

  • gh-127353: Allow to force color output on Windows using environment variables. Patch by Andrey Efremov.

  • gh-125729: Makes the presence of the turtle module dependent on the Tcl/Tk installer option. Previously, the module was always installed but would be unusable without Tcl/Tk.

Tools/Demos

Tests

  • gh-127906: Test the limited C API in test_cppext. Patch by Victor Stinner.

  • gh-127637: Add tests for the dis command-line interface. Patch by Bénédikt Tran.

  • gh-126925: iOS test results are now streamed during test execution, and the deprecated xcresulttool is no longer used.

  • gh-127076: Disable strace based system call tests when LD_PRELOAD is set.

  • gh-127076: Filter out memory-related mmap, munmap, and mprotect calls from file-related ones when testing io behavior using strace.

Security

Library

Documentation

Core and Builtins

  • gh-127740: Fix error message in bytes.fromhex() when given an odd number of digits to properly indicate that an even number of hexadecimal digits is required.

  • gh-127058: PySequence_Tuple now creates the resulting tuple atomically, preventing partially created tuples being visible to the garbage collector or through gc.get_referrers()

  • gh-127599: Fix statistics for increments of object reference counts (in particular, when a reference count was increased by more than 1 in a single operation).

  • gh-127651: When raising ImportError for missing symbols in from imports, use __file__ in the error message if __spec__.origin is not a location

  • gh-127582: Fix non-thread-safe object resurrection when calling finalizers and watcher callbacks in the free threading build.

  • gh-127434: The iOS compiler shims can now accept arguments with spaces.

  • gh-127536: Add missing locks around some list assignment operations in the free threading build.

  • gh-127085: Fix race when exporting a buffer from a memoryview object on the free-threaded build.

  • gh-127238: Correct error message for sys.set_int_max_str_digits().

  • gh-113841: Fix possible undefined behavior division by zero in complex’s _Py_c_pow().

Library

Core and Builtins

  • gh-126491: Add a marking phase to the GC. All objects that can be transitively reached from builtin modules or the stacks are marked as reachable before cycle detection. This reduces the amount of work done by the GC by approximately half.

  • gh-127020: Fix a crash in the free threading build when PyCode_GetCode(), PyCode_GetVarnames(), PyCode_GetCellvars(), or PyCode_GetFreevars() were called from multiple threads at the same time.

  • gh-127010: Simplify GC tracking of dictionaries. All dictionaries are tracked when created, rather than being lazily tracked when a trackable object was added to them. This simplifies the code considerably and results in a slight speedup.

  • gh-126980: Fix __buffer__() of bytearray crashing when READ or WRITE are passed as flags.

  • gh-126937: Fix TypeError when a ctypes.Structure has a field size that doesn’t fit into an unsigned 16-bit integer. Instead, the maximum number of bits is sys.maxsize.

  • gh-126868: Increase performance of int by adding a freelist for compact ints.

  • gh-126881: Fix crash in finalization of dtoa state. Patch by Kumar Aditya.

  • gh-126892: Require cold or invalidated code to “warm up” before being JIT compiled again.

  • gh-126091: Ensure stack traces are complete when throwing into a generator chain that ends in a custom generator.

  • gh-126024: Optimize decoding of short UTF-8 sequences containing non-ASCII characters by approximately 15%.

  • gh-125420: Add memoryview.index() to memoryview objects. Patch by Bénédikt Tran.

  • gh-125420: Add memoryview.count() to memoryview objects. Patch by Bénédikt Tran.

  • gh-124470: Fix crash in free-threaded builds when replacing object dictionary while reading attribute on another thread

  • gh-69639: Implement mixed-mode arithmetic rules combining real and complex numbers as specified by C standards since C99. Patch by Sergey B Kirpichev.

  • gh-120010: Correct invalid corner cases which resulted in (nan+nanj) output in complex multiplication, e.g., (1e300+1j)*(nan+infj). Patch by Sergey B Kirpichev.

  • gh-109746: If _thread.start_new_thread() fails to start a new thread, it deletes its state from interpreter and thus avoids its repeated cleanup on finalization.

C API

Build

  • gh-127865: Fix build failure on systems without thread-locals support.

  • gh-127629: Emscripten builds now include ctypes support.

  • gh-127111: Updated the Emscripten web example to use ES6 modules and be built into a distinct web_example subfolder.

  • gh-115869: Make jit_stencils.h (which is produced during JIT builds) reproducible.

  • gh-126898: The Emscripten build of Python is now based on ES6 modules.

Python 3.14.0 alpha 2

Release date: 2024-11-19

Windows

  • gh-126911: Update credits command output.

  • gh-118973: Ensures the experimental free-threaded install includes the _tkinter module. The optional Tcl/Tk component must also be installed in order for the module to work.

  • gh-126497: Fixes venv failure due to missing redirector executables in experimental free-threaded installs.

  • gh-126074: Removed unnecessary DLLs from Windows embeddable package

  • gh-125315: Avoid crashing in platform due to slow WMI calls on some Windows machines.

  • gh-126084: Fix venvwlauncher to launch pythonw instead of python so no extra console window is created.

  • gh-125842: Fix a SystemError when sys.exit() is called with 0xffffffff on Windows.

  • gh-125550: Enable the Python install manager to detect Python 3.14 installs from the Windows Store.

  • gh-123803: All Windows code pages are now supported as “cpXXX” codecs on Windows.

Tools/Demos

  • gh-126807: Fix extraction warnings in pygettext.py caused by mistaking function definitions for function calls.

  • gh-126167: The iOS testbed was modified so that it can be used by third-party projects for testing purposes.

Tests

  • gh-126909: Fix test_os extended attribute tests to work on filesystems with 1 KiB xattr size limit.

  • gh-125730: Change make test to not run GUI tests by default. Use make ci to run tests with GUI tests instead.

  • gh-124295: Add translation tests to the argparse module.

Security

Library

Documentation

  • gh-126622: Added stub pages for removed modules explaining their removal, where to find replacements, and linking to the last Python version that supported them. Contributed by Ned Batchelder.

  • gh-125277: Require Sphinx 7.2.6 or later to build the Python documentation. Patch by Adam Turner.

  • gh-60712: Include the object type in the lists of documented types. Change by Furkan Onder and Martin Panter.

Core and Builtins

  • gh-126795: Increase the threshold for JIT code warmup. Depending on platform and workload, this can result in performance gains of 1-9% and memory savings of 3-5%.

  • gh-126341: Now ValueError is raised instead of SystemError when trying to iterate over a released memoryview object.

  • gh-126688: Fix a crash when calling os.fork() on some operating systems, including SerenityOS.

Library

  • gh-126066: Fix importlib to not write an incomplete .pyc files when a ulimit or some other operating system mechanism is preventing the write to go through fully.

Core and Builtins

  • gh-126222: Do not include count of “peek” items in _PyUop_num_popped. This ensures that the correct number of items are popped from the stack when a micro-op exits with an error.

  • gh-126366: Fix crash when using yield from on an object that raises an exception in its __iter__.

Library

  • gh-126209: Fix an issue with skip_file_prefixes parameter which resulted in an inconsistent behaviour between the C and Python implementations of warnings.warn(). Patch by Daehee Kim.

Core and Builtins

  • gh-126312: Fix crash during garbage collection on an object frozen by gc.freeze() on the free-threaded build.

  • gh-103951: Relax optimization requirements to allow fast attribute access to module subclasses.

  • gh-126072: Following gh-126101, for Code Objects like lambda, annotation and type alias, we no longer add None to its co_consts.

  • gh-126195: Improve JIT performance by 1.4% on macOS Apple Silicon by using platform-specific memory protection APIs. Patch by Diego Russo.

  • gh-126139: Provide better error location when attempting to use a future statement with an unknown future feature.

  • gh-126072: Add a new attribute in co_flags to indicate whether the first item in co_consts is the docstring. If a code object has no docstring, None will NOT be inserted.

  • gh-126076: Relocated objects such as tuple, bytes and str objects are properly tracked by tracemalloc and its associated hooks. Patch by Pablo Galindo.

  • gh-90370: Avoid temporary tuple creation for vararg in argument passing with Argument Clinic generated code (if arguments either vararg or positional-only).

  • gh-126018: Fix a crash in sys.audit() when passing a non-string as first argument and Python was compiled in debug mode.

  • gh-126012: The memoryview type now supports subscription, making it a generic type.

  • gh-125837: Adds LOAD_SMALL_INT and LOAD_CONST_IMMORTAL instructions. LOAD_SMALL_INT pushes a small integer equal to the oparg to the stack. LOAD_CONST_IMMORTAL does the same as LOAD_CONST but is more efficient for immortal objects. Removes RETURN_CONST instruction.

  • gh-125942: On Android, the errors setting of sys.stdout was changed from surrogateescape to backslashreplace.

  • gh-125859: Fix a crash in the free threading build when gc.get_objects() or gc.get_referrers() is called during an in-progress garbage collection.

  • gh-125868: It was possible in 3.14.0a1 only for attribute lookup to give the wrong value. This was due to an incorrect specialization in very specific circumstances. This is fixed in 3.14.0a2.

  • gh-125498: The JIT has been updated to leverage Clang 19’s new preserve_none attribute, which supports more platforms and is more useful than LLVM’s existing ghccc calling convention. This also removes the need to manually patch the calling convention in LLVM IR, simplifying the JIT compilation process.

  • gh-125703: Correctly honour tracemalloc hooks in specialized Py_DECREF paths. Patch by Pablo Galindo

  • gh-125593: Use color to highlight error locations in traceback from exception group

  • gh-125017: Fix crash on certain accesses to the __annotations__ of staticmethod and classmethod objects.

  • gh-125588: The Python PEG generator can now use f-strings in the grammar actions. Patch by Pablo Galindo

  • gh-125444: Fix illegal instruction for older Arm architectures. Patch by Diego Russo, testing by Ross Burton.

  • gh-118423: Add a new INSTRUCTION_SIZE macro to the cases generator which returns the current instruction size.

  • gh-125038: Fix crash when iterating over a generator expression after direct changes on gi_frame.f_locals. Patch by Mikhail Efimov.

  • gh-124855: Don’t allow the JIT and perf support to be active at the same time. Patch by Pablo Galindo

  • gh-123714: Update JIT compilation to use LLVM 19

  • gh-123930: Improve the error message when a script shadowing a module from the standard library causes ImportError to be raised during a “from” import. Similarly, improve the error message when a script shadowing a third party module attempts to “from” import an attribute from that third party module while still initialising.

  • gh-119793: The map() built-in now has an optional keyword-only strict flag like zip() to check that all the iterables are of equal length. Patch by Wannes Boeykens.

Library

  • gh-118950: Fix bug where SSLProtocol.connection_lost wasn’t getting called when OSError was thrown on writing to socket.

  • gh-113570: Fixed a bug in reprlib.repr where it incorrectly called the repr method on shadowed Python built-in types.

C API

Build

  • gh-126691: Removed the --with-emscripten-target configure flag. We unified the node and browser options and the same build can now be used, independent of target runtime.

  • gh-123877: Use wasm32-wasip1 as the target triple for WASI instead of wasm32-wasi. The latter will eventually be reclaimed for WASI 1.0 while CPython currently only supports WASI preview1.

  • gh-126458: Disable SIMD support for HACL under WASI.

  • gh-89640: Hard-code float word ordering as little endian on WASM.

  • gh-126206: make clinic now runs Argument Clinic using the --force option, thus forcefully regenerating generated code.

  • gh-126187: Introduced Tools/wasm/emscripten.py to simplify doing Emscripten builds.

  • gh-124932: For cross builds, there is now support for having a different install prefix than the host_prefix used by getpath.py. This is set to / by default for Emscripten, on other platforms the default behavior is the same as before.

  • gh-125946: The minimum supported Android version is now 7.0 (API level 24).

  • gh-125940: The Android build now supports 16 KB page sizes.

  • gh-89640: Improve detection of float word ordering on Linux when link-time optimizations are enabled.

  • gh-124928: Emscripten builds now require node >= 18.

  • gh-115382: Fix cross compile failures when the host and target SOABIs match.

Python 3.14.0 alpha 1

Release date: 2024-10-15

macOS

  • gh-124448: Update bundled Tcl/Tk in macOS installer to 8.6.15.

  • gh-123797: Check for runtime availability of ptsname_r function on macos.

  • gh-123418: Updated macOS installer build to use OpenSSL 3.0.15.

Windows

  • gh-124487: Increases Windows required OS and API level to Windows 10.

  • gh-124609: Fix _Py_ThreadId for Windows builds using MinGW. Patch by Tony Roberts.

  • gh-124448: Updated bundled Tcl/Tk to 8.6.15.

  • gh-124254: Ensures experimental free-threaded binaries remain installed when updating.

  • gh-123915: Ensure that Tools\msi\buildrelease.bat uses different directories for AMD64 and ARM64 builds.

  • gh-123418: Updated Windows build to use OpenSSL 3.0.15.

  • gh-123476: Add support for socket.TCP_QUICKACK on Windows platforms.

  • gh-122573: The Windows build of CPython now requires 3.10 or newer.

  • gh-100256: mimetypes no longer fails when it encounters an inaccessible registry key.

  • gh-119679: Ensures correct import libraries are included in Windows installs.

  • gh-119690: Adds Unicode support and fixes audit events for _winapi.CreateNamedPipe.

  • gh-111201: Add support for new pyrepl on Windows

  • gh-119070: Fixes py.exe handling of shebangs like /usr/bin/env python3.12, which were previously interpreted as python3.exe instead of python3.12.exe.

  • gh-117505: Fixes an issue with the Windows installer not running ensurepip in a fully isolated environment. This could cause unexpected interactions with the user site-packages.

  • gh-118209: Avoid crashing in mmap on Windows when the mapped memory is inaccessible due to file system errors or access violations.

  • gh-79846: Makes ssl.create_default_context() ignore invalid certificates in the Windows certificate store

Tools/Demos

  • gh-123418: Update GitHub CI workflows to use OpenSSL 3.0.15 and multissltests to use 3.0.15, 3.1.7, and 3.2.3.

Tests

  • gh-125041: Re-enable skipped tests for zlib on the s390x architecture: only skip checks of the compressed bytes, which can be different between zlib’s software implementation and the hardware-accelerated implementation.

  • gh-124378: Updated test_ttk to pass with Tcl/Tk 8.6.15.

  • gh-124213: Detect whether the test suite is running inside a systemd-nspawn container with --suppress-sync=true option, and skip the test_os and test_mmap tests that are failing in this scenario.

  • gh-124190: Add capability to ignore entire files or directories in check warning CI tool

  • gh-121921: Update Lib/test/crashers/bogus_code_obj.py so that it crashes properly again.

  • gh-112301: Add tooling to check for changes in compiler warnings. Patch by Nate Ohlson.

  • gh-59022: Add tests for pkgutil.extend_path(). Patch by Andreas Stocker.

  • gh-99242: os.getloadavg() may throw OSError when running regression tests under certain conditions (e.g. chroot). This error is now caught and ignored, since reporting load average is optional.

  • gh-121084: Fix test_typing random leaks. Clear typing ABC caches when running tests for refleaks (-R option): call _abc_caches_clear() on typing abstract classes and their subclasses. Patch by Victor Stinner.

  • gh-121160: Add a test for readline.set_history_length(). Note that this test may fail on readline libraries.

  • gh-121200: Fix test_expanduser_pwd2() of test_posixpath. Call getpwnam() to get pw_dir, since it can be different than getpwall() pw_dir. Patch by Victor Stinner.

  • gh-121188: When creating the JUnit XML file, regrtest now escapes characters which are invalid in XML, such as the chr(27) control character used in ANSI escape sequences. Patch by Victor Stinner.

  • gh-120801: Cleaned up fixtures for importlib.metadata tests and consolidated behavior with ‘test.support.os_helper’.

  • gh-119727: Add --single-process command line option to Python test runner (regrtest). Patch by Victor Stinner.

  • gh-119273: Python test runner no longer runs tests using TTY (ex: test_ioctl) in a process group (using setsid()). Previously, tests using TTY were skipped. Patch by Victor Stinner.

  • gh-119050: regrtest test runner: Add XML support to the refleak checker (-R option). Patch by Victor Stinner.

  • gh-101525: Skip test_gdb if the binary is relocated by BOLT. Patch by Donghee Na.

  • gh-107562: Test certificates have been updated to expire far in the future. This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expired certificate errors.

Security

  • gh-125140: Remove the current directory from sys.path when using PyREPL.

  • gh-123678: Upgrade libexpat to 2.6.3

  • gh-112301: Enable compiler options that warn of potential security vulnerabilities.

  • gh-122792: Changed IPv4-mapped ipaddress.IPv6Address to consistently use the mapped IPv4 address value for deciding properties. Properties which have their behavior fixed are is_multicast, is_reserved, is_link_local, is_global, and is_unspecified.

  • gh-112301: Add ability to ignore warnings per file with warning count in warning checking tooling. Patch by Nate Ohlson.

  • gh-112301: Add macOS warning tracking to warning check tooling. Patch by Nate Ohlson.

  • gh-122133: Authenticate the socket connection for the socket.socketpair() fallback on platforms where AF_UNIX is not available like Windows.

    Patch by Gregory P. Smith <greg@krypto.org> and Seth Larson <seth@python.org>. Reported by Ellie <el@horse64.org>

  • gh-121957: Fixed missing audit events around interactive use of Python, now also properly firing for python -i, as well as for python -m asyncio. The events in question are cpython.run_stdin and cpython.run_startup.

  • gh-112301: Enable runtime protections for glibc to abort execution when unsafe behavior is encountered, for all platforms except Windows.

  • gh-121285: Remove backtracking from tarfile header parsing for hdrcharset, PAX, and GNU sparse headers.

  • gh-112301: Add default compiler options to improve security. Enable -Wimplicit-fallthrough, -fstack-protector-strong, -Wtrampolines.

  • gh-118773: Fixes creation of ACLs in os.mkdir() on Windows to work correctly on non-English machines.

  • gh-118486: os.mkdir() on Windows now accepts mode of 0o700 to restrict the new directory to the current user. This fixes CVE 2024-4030 affecting tempfile.mkdtemp() in scenarios where the base temporary directory is more permissive than the default.

Library

IDLE

  • gh-122392: Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors.

  • gh-112938: Fix uninteruptable hang when Shell gets rapid continuous output.

  • gh-122482: Change About IDLE to direct users to discuss.python.org instead of the now unused idle-dev email and mailing list.

  • gh-78889: Stop Shell freezes by blocking user access to non-method sys.stdout.shell attributes, which are all private.

  • gh-120083: Add explicit black IDLE Hovertip foreground color needed for recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles.

  • gh-120104: Fix padding in config and search dialog windows in IDLE.

Documentation

  • gh-124872: Added definitions for context, current context, and context management protocol, updated related definitions to be consistent, and expanded the documentation for contextvars.Context.

  • gh-125018: The importlib.metadata documentation now includes semantic cross-reference targets for the significant documented APIs. This means intersphinx references like importlib.metadata.version() will now work as expected.

  • gh-124720: Update “Using Python on a Mac” section of the “Python Setup and Usage” document and include information on installing free-threading support.

  • gh-124457: Remove coverity scan from the CPython repo. It has not been used since 2020 and is currently unmaintained.

  • gh-116622: Add an Android platform guide, and flag modules not available on Android.

  • gh-123976: Refresh docs around custom providers.

  • gh-70870: Clarified the dual usage of the term “free variable” (both the formal meaning of any reference to names defined outside the local scope, and the narrower pragmatic meaning of nonlocal variables named in co_freevars).

  • gh-121277: Writers of CPython’s documentation can now use next as the version for the versionchanged, versionadded, deprecated directives.

  • gh-117765: Improved documentation for unittest.mock.patch.dict()

  • gh-121749: Fix documentation for PyModule_AddObjectRef().

  • gh-120012: Clarify the behaviours of multiprocessing.Queue.empty() and multiprocessing.SimpleQueue.empty() on closed queues. Patch by Bénédikt Tran.

  • gh-119574: Added some missing environment variables to the output of --help-env.

  • bpo-34008: The Py_Main() documentation moved from the “Very High Level API” section to the “Initialization and Finalization” section.

    Also make it explicit that we expect Py_Main to typically be called instead of Py_Initialize rather than after it (since Py_Main makes its own call to Py_Initialize). Document that calling both is supported but is version dependent on which settings will be applied correctly.

Core and Builtins

  • gh-124375: Fix a crash in the free threading build when the GC runs concurrently with a new thread starting.

  • gh-125221: Fix possible race condition when calling __reduce_ex__() for the first time in the free threading build.

  • gh-125174: Make the handling of reference counts of immortal objects more robust. Immortal objects with reference counts that deviate from their original reference count by up to a billion (half a billion on 32 bit builds) are still counted as immortal.

  • gh-125039: Make this_instr and prev_instr const in cases generator.

Library

Core and Builtins

  • gh-124871: Fix compiler bug (in some versions of 3.13) where an assertion fails during reachability analysis.

  • gh-123378: Fix a crash in the __str__() method of UnicodeError objects when the UnicodeError.start and UnicodeError.end values are invalid or out-of-range. Patch by Bénédikt Tran.

  • gh-118093: Improve the experimental JIT compiler’s ability to stay “on trace” when encountering highly-biased branches.

  • gh-124642: Fixed scalability issue in free-threaded builds for lock-free reads from dictionaries in multi-threaded scenarios

  • gh-116510: Fix a crash caused by immortal interned strings being shared between sub-interpreters that use basic single-phase init. In that case, the string can be used by an interpreter that outlives the interpreter that created and interned it. For interpreters that share obmalloc state, also share the interned dict with the main interpreter.

  • gh-116510: Fix a bug that can cause a crash when sub-interpreters use “basic” single-phase extension modules. Shared objects could refer to PyGC_Head nodes that had been freed as part of interpreter cleanup.

  • gh-119180: The __main__ module no longer always contains an __annotations__ dictionary in its global namespace.

  • gh-124547: When deallocating an object with inline values whose __dict__ is still live: if memory allocation for the inline values fails, clear the dictionary. Prevents an interpreter crash.

  • gh-124513: Fix a crash in FrameLocalsProxy constructor: check the number of arguments. Patch by Victor Stinner.

  • gh-124442: Fix nondeterminism in compilation by sorting the value of __static_attributes__. Patch by kp2pml30.

  • gh-124285: Fix bug where bool(a) can be invoked more than once during the evaluation of a compound boolean expression.

  • gh-123856: Fix PyREPL failure when a keyboard interrupt is triggered after using a history search

  • gh-65961: Deprecate the setting and using __package__ and __cached__.

  • gh-119726: The JIT now generates more efficient code for calls to C functions resulting in up to 0.8% memory savings and 1.5% speed improvement on AArch64. Patch by Diego Russo.

  • gh-122878: Use the pager binary, if available (e.g. on Debian and derivatives), to display REPL help().

  • gh-124188: Fix reading and decoding a line from the source file with non-UTF-8 encoding for syntax errors raised in the compiler.

  • gh-124027: Support <page up>, <page down>, and <delete> keys in the Python REPL when $TERM is set to vt100.

  • gh-124022: Fix bug where docstring is removed from classes in interactive mode.

  • gh-123958: docstrings are now removed from the optimized AST in optimization level 2.

  • gh-123923: The f_executable field in the internal _PyInterpreterFrame struct now uses a tagged pointer. Profilers and debuggers that uses this field should clear the least significant bit to recover the PyObject* pointer.

  • gh-77894: Fix possible crash in the garbage collector when it tries to break a reference loop containing a memoryview object. Now a memoryview object can only be cleared if there are no buffers that refer it.

  • gh-120221: asyncio REPL is now again properly recognizing KeyboardInterrupts. Display of exceptions raised in secondary threads is fixed.

  • gh-119310: Allow the new interactive shell to read history files written with the editline library that use unicode-escaped entries. Patch by aorcajo and Łukasz Langa.

  • gh-123572: Fix key mappings for various F-keys in Windows for the new REPL. Patch by devdanzin

Library

  • gh-123614: Add turtle.save() to easily save Turtle drawings as PostScript files. Patch by Marie Roald and Yngve Mardal Moe.

Core and Builtins

  • gh-123339: Setting the __module__ attribute for a class now removes the __firstlineno__ item from the type’s dict, so they will no longer be inconsistent.

  • gh-119034: Change <page up> and <page down> keys of the Python REPL to history search forward/backward. Patch by Victor Stinner.

  • gh-123562: Improve SyntaxError message for using case ... as ... with not a name.

  • gh-123545: Fix a double decref in rare cases on experimental JIT builds.

  • gh-123484: Fix _Py_DebugOffsets for long objects to be relative to the start of the object rather than the start of a subobject.

  • gh-123446: Fix empty function name in TypeError when builtin magic methods are used without the required args.

  • gh-123440: Improve SyntaxError message for using except as with not a name.

  • gh-116017: Improved JIT memory consumption by periodically freeing memory used by infrequently-executed code. This change is especially likely to improve the memory footprint of long-running programs.

  • gh-123344: Add AST optimizations for type parameter defaults.

  • gh-123321: Prevent Parser/myreadline race condition from segfaulting on multi-threaded use. Patch by Bar Harel and Amit Wienner.

  • gh-123177: Fix a bug causing stray prompts to appear in the middle of wrapped lines in the new REPL.

  • gh-122982: Extend the deprecation period for bool inversion (~) by two years.

  • gh-123271: Make concurrent iterations over the same zip() iterator safe under free-threading.

  • gh-123275: Support -X gil=1 and PYTHON_GIL=1 on non-free-threaded builds.

  • gh-123177: Deactivate line wrap in the Apple Terminal via a ANSI escape code. Patch by Pablo Galindo

  • gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer. Patch by Pablo Galindo

  • gh-122298: Restore printout of GC stats when gc.set_debug(gc.DEBUG_STATS) is called. This feature was accidentally removed when implementing incremental GC.

  • gh-121804: Correctly show error locations when a SyntaxError is raised in the basic REPL. Patch by Sergey B Kirpichev.

  • gh-115776: Enables inline values (Python’s equivalent of hidden classes) on any class who’s instances are of a fixed size.

  • gh-123142: Fix too-wide source location in exception tracebacks coming from broken iterables in comprehensions.

  • gh-123048: Fix a bug where pattern matching code could emit a JUMP_FORWARD with no source location.

  • gh-118093: Break up CALL_ALLOC_AND_ENTER_INIT into micro-ops and relax requirement for exact args, in order to increase the amount of code supported by tier 2.

  • gh-123123: Fix displaying SyntaxError exceptions covering multiple lines. Patch by Pablo Galindo

  • gh-123083: Fix a potential use-after-free in STORE_ATTR_WITH_HINT.

  • gh-123022: Fix crash in free-threaded build when calling Py_Initialize() from a non-main thread.

  • gh-118093: Add three specializations for CALL_KW:

    • CALL_KW_PY for calls to Python functions

    • CALL_KW_BOUND_METHOD for calls to bound methods

    • CALL_KW_NON_PY for all other calls

  • gh-122821: Make sure that branches in while statements have consistent offsets for sys.monitoring. while statements are now compiled with a simple jump at the end of the body, instead of duplicating the test.

  • gh-122907: Building with HAVE_DYNAMIC_LOADING now works as well as it did in 3.12. Existing deficiences will be addressed separately. (See https://github.com/python/cpython/issues/122950.)

  • gh-122888: Fix crash on certain calls to str() with positional arguments of the wrong type. Patch by Jelle Zijlstra.

  • gh-118093: Improve the experimental JIT’s handling of polymorphic code.

  • gh-122697: Fixed memory leaks at interpreter shutdown in the free-threaded build, and also reporting of leaked memory blocks via -X showrefcount.

  • gh-116622: Fix Android stdout and stderr messages being truncated or lost.

  • gh-122527: Fix a crash that occurred when a PyStructSequence was deallocated after its type’s dictionary was cleared by the GC. The type’s tp_basicsize now accounts for non-sequence fields that aren’t included in the Py_SIZE of the sequence.

  • gh-122445: Add only fields which are modified via self.* to __static_attributes__.

  • gh-122417: In the free-threaded build, the reference counts for heap type objects are now partially stored in a distributed manner in per-thread arrays. This reduces contention on the heap type’s reference count fields when creating or destroying instances of the same type from multiple threads concurrently.

  • gh-116090: Fix an issue in JIT builds that prevented some for loops from correctly firing RAISE monitoring events.

  • gh-122300: Preserve AST nodes for f-string with single-element format specifiers. Patch by Pablo Galindo

  • gh-120906: frame.f_locals now supports arbitrary hashable objects as keys.

  • gh-122239: When a list, tuple or dict with too many elements is unpacked, show the actual length in the error message.

  • gh-122245: Detection of writes to __debug__ is moved from the compiler’s codegen stage to the symtable. This means that these errors are now detected even in code that is optimized away before codegen (such as assertions with the -O command line option).

  • gh-122234: Specializations for sums with float and complex inputs in sum() now always use compensated summation. Also, for integer items in above specializations: PyLong_AsDouble() is used, instead of PyLong_AsLongAndOverflow(). Patch by Sergey B Kirpichev.

  • gh-122208: Dictionary watchers now only deliver the PyDict_EVENT_ADDED event when the insertion is in a known good state to succeed.

  • gh-122160: Remove the BUILD_CONST_KEY_MAP opcode. Use BUILD_MAP instead.

  • gh-122029: Emit c_call events in sys.setprofile() when a PyMethodObject pointing to a PyCFunction is called.

  • gh-122026: Fix a bug that caused the tokenizer to not correctly identify mismatched parentheses inside f-strings in some situations. Patch by Pablo Galindo

  • gh-99108: Python’s hashlib now unconditionally uses the vendored HACL* library for Blake2. Python no longer accepts libb2 as an optional dependency for Blake2.

    We refreshed HACL* to the latest version, and now vendor HACL*’s 128-bit and 256-bit wide vector implementations for Blake2, which are used on x86/x64 toolchains when the required CPU features are available at runtime.

    HACL*’s 128-bit wide vector implementation of Blake2 can also run on ARM NEON and Power8, but lacking evidence of a performance gain, these are not enabled (yet).

Library

Core and Builtins

  • gh-121860: Fix crash when rematerializing a managed dictionary after it was deleted.

  • gh-121795: Improve performance of set membership testing, set.remove() and set.discard() when the argument is a set.

  • gh-121814: Fixed the SegFault when PyEval_SetTrace() is used with no Python frame on stack.

  • gh-121295: Fix PyREPL console getting into a blocked state after interrupting a long paste

  • gh-121794: Fix bug in free-threaded Python where a resurrected object could lead to a negative ref count assertion failure.

  • gh-121657: Improve the SyntaxError message if the user tries to use yield from outside a function.

  • gh-121609: Fix pasting of characters containing unicode character joiners in the new REPL. Patch by Marta Gomez Macias

  • gh-121297: Previously, incorrect usage of await or asynchronous comprehensions in code removed by the -O option was not flagged by the Python compiler. Now, such code raises SyntaxError. Patch by Jelle Zijlstra.

  • gh-117482: Unexpected slot wrappers are no longer created for builtin static types in subinterpreters.

  • gh-121562: Optimized performance of hex_from_char by replacing switch-case with a lookup table

  • gh-121499: Fix a bug affecting how multi-line history was being rendered in the new REPL after interacting with the new screen cache. Patch by Pablo Galindo

  • gh-121497: Fix a bug that was preventing the REPL to correctly respect the history when an input hook was set. Patch by Pablo Galindo

  • gh-121012: Tier 2 execution now ensures that list iterators remain exhausted, once they become exhausted.

  • gh-121439: Allow tuples of length 20 in the freelist to be reused.

  • gh-121288: ValueError messages for list.index(), range.index(), deque.index(), deque.remove() and ShareableList.index() no longer contain the repr of the searched value (which can be arbitrary large) and are consistent with error messages for other index() and remove() methods.

  • gh-121368: Fix race condition in _PyType_Lookup in the free-threaded build due to a missing memory fence. This could lead to _PyType_Lookup returning incorrect results on arm64.

  • gh-121149: Added specialization for summation of complexes, this also improves accuracy of builtin sum() for such inputs. Patch by Sergey B Kirpichev.

  • gh-121130: Fix f-strings with debug expressions in format specifiers. Patch by Pablo Galindo

Library

  • gh-121381: Remove subprocess._USE_VFORK escape hatch code and documentation. It was added just in case, and doesn’t have any known cases that require it.

Core and Builtins

  • gh-119726: Optimize code layout for calls to C functions from the JIT on AArch64. Patch by Diego Russo.

  • gh-121115: PyLong_AsNativeBytes() no longer uses __index__() methods by default. The Py_ASNATIVEBYTES_ALLOW_INDEX flag has been added to allow it.

  • gh-120838: Py_Finalize() and Py_FinalizeEx() now always run with the main interpreter active.

  • gh-113433: Subinterpreters now get cleaned up automatically during runtime finalization.

  • gh-119726: Improve the speed and memory use of C function calls from JIT code on AArch64. Patch by Diego Russo

  • gh-116017: Simplify the warmup mechanism used for “side exits” in JIT code, resulting in slightly better performance and slightly lower memory usage for most platforms.

  • gh-98442: Fix too wide source locations of the cleanup instructions of a with statement.

  • gh-120754: Reduce the number of system calls invoked when reading a whole file (ex. open('a.txt').read()). For a sample program that reads the contents of the 400+ .rst files in the cpython repository Doc folder, there is an over 10% reduction in system call count.

  • gh-119462: Make sure that invariants of type versioning are maintained: * Superclasses always have their version number assigned before subclasses * The version tag is always zero if the tag is not valid. * The version tag is always non-if the tag is valid.

  • gh-120437: Fix _CHECK_STACK_SPACE optimization problems introduced in gh-118322.

  • gh-120722: Correctly set the bytecode position on return instructions within lambdas. Patch by Jelle Zijlstra.

  • gh-120367: Fix bug where compiler creates a redundant jump during pseudo-op replacement. Can only happen with a synthetic AST that has a try on the same line as the instruction following the exception handler.

  • gh-120507: Remove the BEFORE_WITH and BEFORE_ASYNC_WITH instructions. Add the new LOAD_SPECIAL instruction. Generate code for with and async with statements using the new instruction.

  • gh-113993: Strings interned with sys.intern() are again garbage-collected when no longer used, as per the documentation. Strings interned with the C function PyUnicode_InternInPlace() are still immortal. Internals of the string interning mechanism have been changed. This may affect performance and identities of str objects.

Library

  • gh-120485: Add an override of allow_reuse_port on classes subclassing socketserver.TCPServer where allow_reuse_address is also overridden.

Core and Builtins

  • gh-120384: Fix an array out of bounds crash in list_ass_subscript, which could be invoked via some specifically tailored input: including concurrent modification of a list object, where one thread assigns a slice and another clears it.

  • gh-120367: Fix crash in compiler on code with redundant NOPs and JUMPs which show up after exception handlers are moved to the end of the code.

Library

Core and Builtins

  • gh-120397: Improve the throughput by up to two times for the str.count(), bytes.count() and bytearray.count() methods for counting single characters.

  • gh-120221: Deliver real signals on Ctrl-C and Ctrl-Z in the new REPL. Patch by Pablo Galindo

  • gh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (python -i). Patch by Pablo Galindo

  • gh-93691: Fix source locations of instructions generated for the iterator of a for statement.

  • gh-120198: Fix a crash when multiple threads read and write to the same __class__ of an object concurrently.

  • gh-120298: Fix use-after free in list_richcompare_impl which can be invoked via some specifically tailored evil input.

  • gh-119666: Fix a compiler crash in the case where two comprehensions in class scope both reference __class__.

  • gh-119726: JIT: Re-use trampolines on AArch64 when creating stencils. Patch by Diego Russo

  • gh-120225: Fix crash in compiler on empty block at end of exception handler.

  • gh-93691: Fix source locations of instructions generated for with statements.

  • gh-120097: FrameLocalsProxy now subclasses collections.abc.Mapping and can be matched as a mapping in match statements

  • gh-120080: Direct call to the int.__round__() now accepts None as a valid argument.

  • gh-119933: Improve SyntaxError messages for invalid expressions in a type parameters bound, a type parameter constraint tuple or a default type parameter. Patch by Bénédikt Tran.

  • gh-119724: Reverted improvements to error messages for elif/else statements not matching any valid statements, which made in hard to locate the syntax errors inside those elif/else blocks.

  • gh-119879: String search is now slightly faster for certain cases. It now utilizes last character gap (good suffix rule) for two-way periodic needles.

  • gh-119842: Honor PyOS_InputHook() in the new REPL. Patch by Pablo Galindo

  • gh-119180: classmethod() and staticmethod() now wrap the __annotations__ and __annotate__ attributes of their underlying callable lazily. See PEP 649. Patch by Jelle Zijlstra.

  • gh-119821: Fix execution of annotation scopes within classes when globals is set to a non-dict. Patch by Jelle Zijlstra.

  • gh-118934: Make PyEval_GetLocals return borrowed reference

  • gh-119740: Remove the previously-deprecated delegation of int() to __trunc__().

  • gh-119689: Generate stack effect metadata for pseudo instructions from bytecodes.c.

  • gh-109218: complex() accepts now a string only as a positional argument. Passing a complex number as the “real” or “imag” argument is deprecated; it should only be passed as a single positional argument.

  • gh-119548: Add a clear command to the REPL. Patch by Pablo Galindo

  • gh-111999: Fix the signature of str.format_map().

  • gh-119560: An invalid assert in beta 1 has been removed. The assert would fail if PyState_FindModule() was used in an extension module’s init function before the module def had been initialized.

  • gh-119369: Fix deadlock during thread deletion in free-threaded build, which could occur when the GIL was enabled at runtime.

  • gh-119525: Fix deadlock involving _PyType_Lookup() cache in the free-threaded build when the GIL is dynamically enabled at runtime.

  • gh-119258: Eliminate type version guards in the tier two interpreter.

    Note that setting the tp_version_tag manually (which has never been supported) may result in crashes.

  • gh-119311: Fix bug where names are unexpectedly mangled in the bases of generic classes.

  • gh-119395: Fix bug where names appearing after a generic class are mangled as if they are in the generic class.

  • gh-119372: Correct invalid corner cases in complex division (resulted in (nan+nanj) output), e.g. 1/complex('(inf+infj)'). Patch by Sergey B Kirpichev.

  • gh-119180: Evaluation of annotations is now deferred. See PEP 649 for details.

  • gh-119180: Replace LOAD_ASSERTION_ERROR opcode with LOAD_COMMON_CONSTANT and add support for NotImplementedError.

  • gh-119213: Non-builtin modules built with argument clinic were crashing if used in a subinterpreter before the main interpreter. The objects that were causing the problem by leaking between interpreters carelessly have been fixed.

  • gh-119011: Fixes type.__type_params__ to return an empty tuple instead of a descriptor.

  • gh-118692: Avoid creating unnecessary StopIteration instances for monitoring.

  • gh-119180: Add an __annotate__ attribute to functions, classes, and modules as part of PEP 649. Patch by Jelle Zijlstra.

  • gh-119049: Fix displaying the source line for warnings created by the C API if the warnings module had not yet been imported.

  • gh-119057: Improve ZeroDivisionError error message. Now, all error messages are harmonized: all /, //, and % operations just use “division by zero” message. And 0 ** -1 operation uses “zero to a negative power”.

  • gh-118844: Fix build failures when configuring with both --disable-gil and --enable-experimental-jit.

  • gh-118921: Add copy() method for FrameLocalsProxy which returns a snapshot dict for local variables.

  • gh-117657: Fix data races on the field that stores a pointer to the interpreter’s main thread that occur in free-threaded builds.

  • gh-118750: If the C version of the decimal module is available, int(str) now uses it to supply an asymptotically much faster conversion. However, this only applies if the string contains over about 2 million digits.

  • gh-118767: Using NotImplemented in a boolean context now raises TypeError. Contributed by Jelle Zijlstra.

  • gh-118561: Fix race condition in free-threaded build where list.extend() could expose uninitialised memory to concurrent readers.

  • gh-117139: Convert the Python evaluation stack to use internal stack references. The purpose is to support tagged pointers. In PEP 703, this will allow for its form of deferred reference counting. For both the default and free-threaded builds, this sets up the infrastructure for unboxed integers in the future.

Library

Core and Builtins

  • gh-117558: Improve error messages when a string, bytes or bytearray object of length 1 is expected.

  • gh-117195: Avoid assertion failure for debug builds when calling object.__sizeof__(1)

  • gh-116022: Improve the __repr__() output of AST nodes.

  • gh-114091: Changed the error message for awaiting something that can’t be awaited from “object <type> can’t be used in an await expression” to “’<type>’ object can’t be awaited”.

  • gh-113190: Py_Finalize() now deletes all interned strings.

  • gh-84978: Add class methods float.from_number() and complex.from_number().

  • gh-95144: Improve the error message from a in b when b is not a container to mention the term “container”.

  • bpo-24766: Fix handling of doc argument to subclasses of property.

C API

Build

  • gh-125269: Fix detection of whether -latomic is needed when cross-compiling CPython using the configure script.

  • gh-123990: Remove WITH_FREELISTS macro and --without-freelists build configuration

  • gh-124102: Update internal documentation under PCbuild, so it now correctly states that Windows requires VS2017 or later and Python 3.10 or later

  • gh-124043: Building using --with-trace-refs is (temporarily) disallowed when the GIL is disabled.

  • gh-123418: Updated Android build to use OpenSSL 3.0.15.

  • gh-123297: Propagate the value of LDFLAGS to LDCXXSHARED in sysconfig. Patch by Pablo Galindo

  • gh-121634: Allow for specifying the target compile triple for WASI.

  • gh-122578: Use WASI SDK 24 for testing.

  • gh-116622: Rename build variable MODULE_LDFLAGS back to LIBPYTHON, as it’s used by package build systems (e.g. Meson).

  • gh-118943: Fix an issue where the experimental JIT could be built several times by the make regen-all target, leading to possible race conditions on heavily parallelized builds.

  • gh-121996: Introduce ./configure –disable-safety and –enable-slower-safety options. Patch by Donghee Na.

  • gh-120522: Added a --with-app-store-compliance option to patch out known issues with macOS/iOS App Store review processes.

  • gh-120371: Support WASI SDK 22 by explicitly skipping functions that are just stubs in wasi-libc.

  • gh-121731: Fix mimalloc compile error on GNU/Hurd

  • gh-121487: Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc.

  • gh-121467: Fix a Makefile bug that prevented mimalloc header files from being installed.

  • gh-121103: On POSIX systems, excluding macOS framework installs, the lib directory for the free-threaded build now includes a “t” suffix to avoid conflicts with a co-located default build installation.

  • gh-120831: The default minimum iOS version was increased to 13.0.

  • gh-121082: Fix build failure when the developer use --enable-pystats arguments in configuration command after #118450.

  • gh-120671: Fix failing configure tests due to a missing space when appending to CFLAGS.

  • gh-120602: Correctly handle LLVM installs with LLVM_VERSION_SUFFIX when building with --enable-experimental-jit.

  • gh-120688: On WASI in debug mode, Python is now built with compiler flag -O3 instead of -Og, to support more recursive calls. Patch by Victor Stinner.

  • gh-118943: Fix a possible race condition affecting parallel builds configured with --enable-experimental-jit, in which FileNotFoundError could be caused by another process already moving jit_stencils.h.new to jit_stencils.h.

  • gh-120326: On Windows, fix build error when --disable-gil and --experimental-jit options are combined.

  • gh-120291: Make the python-config shell script compatible with non-bash shells.

  • gh-113565: Improve curses and curses.panel dependency checks in configure.

  • gh-119729: On POSIX systems, the pkg-config (.pc) filenames now include the ABI flags, which may include debug (“d”) and free-threaded (“t”). For example: * python-3.14.pc (default, non-debug build) * python-3.14d.pc (default, debug build) * python-3.14t.pc (free-threaded build)

  • gh-119400: make_ssl_certs, the script that prepares certificate data for the test suite, now allows specifying expiration dates.

  • gh-115119: Fall back to the bundled libmpdec if a system version cannot be found.

  • gh-119132: Update sys.version to identify whether the build is default build or free-threading build. Patch By Donghee Na.

  • gh-118836: Fix an AssertionError when building with --enable-experimental-jit and the compiler emits a SHT_NOTE section.

  • gh-118943: Fix a possible race condition affecting parallel builds configured with --enable-experimental-jit, in which compilation errors could be caused by an incompletely-generated header file.

Python 3.13.0 beta 1

Release date: 2024-05-08

Security

  • gh-116741: Update bundled libexpat to 2.6.2

  • gh-117233: Detect BLAKE2, SHA3, Shake, & truncated SHA512 support in the OpenSSL-ish libcrypto library at build time. This allows hashlib to be used with libraries that do not to support every algorithm that upstream OpenSSL does.

Core and Builtins

  • gh-118414: Add instrumented opcodes to YIELD_VALUE assertion for tracing cases.

  • gh-117953: When a builtin or extension module is imported for the first time, while a subinterpreter is active, the module’s init function is now run by the main interpreter first before import continues in the subinterpreter. Consequently, single-phase init modules now fail in an isolated subinterpreter without the init function running under that interpreter, whereas before it would run under the subinterpreter before failing, potentially leaving behind global state and callbacks and otherwise leaving the module in an inconsistent state.

  • gh-117549: Don’t use designated initializer syntax in inline functions in internal headers. They cause problems for C++ or MSVC users who aren’t yet using the latest C++ standard (C++20). While internal, pycore_backoff.h, is included (indirectly, via pycore_code.h) by some key 3rd party software that does so for speed.

Library

  • gh-95382: Improve performance of json.dumps() and json.dump() when using the argument indent. Depending on the data the encoding using json.dumps() with indent can be up to 2 to 3 times faster.

Core and Builtins

  • gh-116322: In --disable-gil builds, the GIL will be enabled while loading C extension modules. If the module indicates that it supports running without the GIL, the GIL will be disabled once loading is complete. Otherwise, the GIL will remain enabled for the remainder of the interpreter’s lifetime. This behavior does not apply if the GIL has been explicitly enabled or disabled with PYTHON_GIL or -Xgil.

  • gh-118513: Fix incorrect UnboundLocalError when two comprehensions in the same function both reference the same name, and in one comprehension the name is bound while in the other it’s an implicit global.

  • gh-118518: Allow the Linux perf support to work without frame pointers using perf’s advanced JIT support. The feature is activated when using the PYTHON_PERF_JIT_SUPPORT environment variable or when running Python with -Xperf_jit. Patch by Pablo Galindo.

  • gh-117514: Add sys._is_gil_enabled() function that returns whether the GIL is currently enabled. In the default build it always returns True because the GIL is always enabled. In the free-threaded build, it may return True or False.

  • gh-118164: Break a loop between the Python implementation of the decimal module and the Python code for integer to string conversion. Also optimize integer to string conversion for values in the range from 9_000 to 135_000 decimal digits.

  • gh-118473: Fix sys.set_asyncgen_hooks() not to be partially set when raising TypeError.

  • gh-118465: Compiler populates the new __firstlineno__ field on a class with the line number of the first line of the class definition.

  • gh-118492: Fix an issue where the type cache can expose a previously accessed attribute when a finalizer is run.

  • gh-117714: update async_generator.athrow().close() and async_generator.asend().close() to close their section of the underlying async generator

  • gh-111201: The interactive interpreter is now implemented in Python, which allows for a number of new features like colors, multiline input, history viewing, and paste mode. Contributed by Pablo Galindo, Łukasz Langa and Lysandros Nikolaou based on code from the PyPy project.

  • gh-74929: Implement PEP 667: converted FrameType.f_locals and PyFrame_GetLocals() to return a write-through proxy object when the frame refers to a function or comprehension.

  • gh-116767: Fix crash in compiler on ‘async with’ that has many context managers.

  • gh-118335: Change how to use the tier 2 interpreter. Instead of running Python with -X uops or setting the environment variable PYTHON_UOPS=1, this choice is now made at build time by configuring with --enable-experimental-jit=interpreter.

    Beware! This changes the environment variable to enable or disable micro-ops to PYTHON_JIT. The old PYTHON_UOPS is no longer used.

  • gh-118306: Update JIT compilation to use LLVM 18

  • gh-118160: Annotation scopes within classes can now contain comprehensions. However, such comprehensions are not inlined into their parent scope at runtime. Patch by Jelle Zijlstra.

  • gh-118272: Fix bug where generator.close does not free the generator frame’s locals.

  • gh-118216: Don’t consider __future__ imports with dots before the module name.

  • gh-118074: Make sure that the Executor objects in the COLD_EXITS array aren’t assumed to be GC-able (which would access bytes outside the object).

  • gh-107674: Lazy load frame line number to improve performance of tracing

  • gh-118082: Improve SyntaxError message for imports without names, like in from x import and import cases. It now points out to users that import expects at least one name after it.

  • gh-118090: Improve SyntaxError message for empty type param brackets.

  • gh-117958: Added a get_jit_code() method to access JIT compiled machine code from the UOp Executor when the experimental JIT is enabled. Patch by Anthony Shaw.

  • gh-117901: Add option for compiler’s codegen to save nested instruction sequences for introspection.

  • gh-116622: Redirect stdout and stderr to system log when embedded in an Android app.

  • gh-109118: annotation scope within class scopes can now contain lambdas.

  • gh-117894: Prevent agen.aclose() objects being re-used after .throw().

  • gh-117881: prevent concurrent access to an async generator via athrow().throw() or asend().throw()

  • gh-117536: Fix a RuntimeWarning when calling agen.aclose().throw(Exception).

  • gh-117755: Fix mimalloc allocator for huge memory allocation (around 8,589,934,592 GiB) on s390x. Patch by Victor Stinner.

  • gh-117750: Fix issue where an object’s dict would get out of sync with the object’s internal values when being cleared. obj.__dict__.clear() now clears the internal values, but leaves the dict attached to the object.

  • gh-117431: Improve the performance of the following bytes and bytearray methods by adapting them to the METH_FASTCALL calling convention:

    • count()

    • find()

    • index()

    • rfind()

    • rindex()

  • gh-117709: Speed up calls to str() with positional-only argument, by using the PEP 590 vectorcall calling convention. Patch by Erlend Aasland.

  • gh-117680: Give _PyInstructionSequence a Python interface and use it in tests.

  • gh-115776: Statically allocated objects are, by definition, immortal so must be marked as such regardless of whether they are in extension modules or not.

  • gh-117385: Remove unhandled PY_MONITORING_EVENT_BRANCH and PY_MONITORING_EVENT_EXCEPTION_HANDLED events from sys.settrace().

  • gh-116322: Extension modules may indicate to the runtime that they can run without the GIL. Multi-phase init modules do so by calling providing Py_MOD_GIL_NOT_USED for the Py_mod_gil slot, while single-phase init modules call PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED) from their init function.

  • gh-116129: Implement PEP 696, adding support for defaults on type parameters. Patch by Jelle Zijlstra.

  • gh-93502: Add two new functions to the C-API, PyRefTracer_SetTracer() and PyRefTracer_GetTracer(), that allows to track object creation and destruction the same way the tracemalloc module does. Patch by Pablo Galindo

  • gh-107674: Improved the performance of sys.settrace() significantly

  • gh-95754: Improve the error message when a script shadowing a module from the standard library causes AttributeError to be raised. Similarly, improve the error message when a script shadowing a third party module attempts to access an attribute from that third party module while still initialising.

  • gh-99180: Elide uninformative traceback indicators in return and simple assignment statements. Patch by Pablo Galindo.

  • gh-105879: Allow the globals and locals arguments to exec() and eval() to be passed as keywords.

Library

  • gh-118418: A DeprecationWarning is now emitted if you fail to pass a value to the new type_params parameter of typing._eval_type() or typing.ForwardRef._evaluate(). (Using either of these private and undocumented functions is discouraged to begin with, but failing to pass a value to the type_params parameter may lead to incorrect behaviour on Python 3.12 or newer.)

  • gh-118660: Add an optional second type parameter to typing.ContextManager and typing.AsyncContextManager, representing the return types of __exit__() and __aexit__() respectively. This parameter defaults to bool | None.

  • gh-118650: The enum module allows method named _repr_* to be defined on Enum types.

  • gh-118648: Add type parameter defaults to typing.Generator and typing.AsyncGenerator.

  • gh-101137: Mime type text/x-rst is now supported by mimetypes.

  • gh-118164: The Python implementation of the decimal module could appear to hang in relatively small power cases (like 2**117) if context precision was set to a very high value. A different method to check for exactly representable results is used now that doesn’t rely on computing 10**precision (which could be effectively too large to compute).

  • gh-111744: breakpoint() and pdb.set_trace() now enter the debugger immediately after the call rather than before the next line is executed.

  • gh-118500: Add pdb support for zipapps

  • gh-118406: Add signature for sqlite3.Connection objects.

  • gh-101732: Use a Y2038 compatible openssl time function when available.

  • gh-118404: Fix inspect.signature() for non-comparable callables.

  • gh-118402: Fix inspect.signature() for the result of the functools.cmp_to_key() call.

  • gh-116622: On Android, sysconfig.get_platform now returns the format specified by PEP 738.

  • gh-118285: Allow to specify the signature of custom callable instances of extension type by the __text_signature__ attribute. Specify signatures of operator.attrgetter, operator.itemgetter, and operator.methodcaller instances.

  • gh-118314: Fix an edge case in binascii.a2b_base64() strict mode, where excessive padding is not detected when no padding is necessary.

  • gh-118271: Add the PhotoImage methods read() to read an image from a file and data() to get the image data. Add background and grayscale parameters to PhotoImage method write().

  • gh-118225: Add the PhotoImage method copy_replace() to copy a region from one image to other image, possibly with pixel zooming and/or subsampling. Add from_coords parameter to PhotoImage methods copy(), zoom() and subsample(). Add zoom and subsample parameters to PhotoImage method copy().

  • gh-118221: Fix a bug where sqlite3.Connection.iterdump() could fail if a custom row factory was used. Patch by Erlend Aasland.

  • gh-118013: Fix regression introduced in gh-103193 that meant that calling inspect.getattr_static() on an instance would cause a strong reference to that instance’s class to persist in an internal cache in the inspect module. This caused unexpected memory consumption if the class was dynamically created, the class held strong references to other objects which took up a significant amount of memory, and the cache contained the sole strong reference to the class. The fix for the regression leads to a slowdown in getattr_static(), but the function should still be significantly faster than it was in Python 3.11. Patch by Alex Waygood.

  • gh-118218: Speed up itertools.pairwise() in the common case by up to 1.8x.

  • gh-117486: Improve the behavior of user-defined subclasses of ast.AST