Changelog¶
Python next¶
Release date: XXXX-XX-XX
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.
gh-151163: Updated macOS installer to include SQLite version 3.53.2.
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.
Windows¶
gh-68048: Creating a
mmap.mmapobject on Windows no longer resets the position of the underlying file to zero, as on other platforms.gh-69573:
msvcrt.putch()andmsvcrt.putwch()now check the return value of the underlying_putch()and_putwch()C functions and raiseOSErroron failure, for example when the process has no console attached, instead of silently ignoring the error.gh-124111: Updated Windows builds to use Tcl/Tk 9.0.4.
gh-152433: Modernize fileutils removing GetFileInformationByHandle API calls and allow build for Universal Windows Platform.
gh-152433:
_winapi: implementGetVersion()UWP alternative.gh-152433: Restores the
mmapmodule when CPython is built from source for specific Windows API sets.gh-152433: Use the Windows API
GetFileSizeEx()for memory mapped files, rather than the olderGetFileSize().gh-152433: Implement
os.cpu_count()for Universal Windows Platform.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.
gh-149786: Fixes virtual environment launchers on Windows free-threaded builds.
gh-138489: Windows distributions now include a
build-details.jsonfile (see PEP 739). The legacy installer does not install it, but all other distributions from python.org and all preset configurations in thePC\layoutscript will include one.gh-140146: Prevent
tkinterfrom 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.gh-86768:
os.lseek()andseek()of file objects now raiseOSErrorfor pipes on Windows, andseekable()now returnsFalsefor them. Previously seeking a pipe silently appeared to succeed. As a consequence, opening a pipe in a read-write binary mode ('r+b'or'w+b') now raisesio.UnsupportedOperationunless buffering is disabled.bpo-40851:
subprocess.Popenwithshell=Trueon Windows now honorswShowWindowof the startupinfo argument, so the console window of the started program can be shown. Previously it was always hidden.
Tools/Demos¶
gh-64660: Argument Clinic return converters no longer need to hardcode the name of the variable returned by the parsing function. It is now available as
data.parser_retval.gh-155266: Fix Argument Clinic for a function whose only parameter is in an optional group. It generated
METH_O, which made the argument mandatory and did not pass the flag of the group.gh-155218: Fix Argument Clinic generating the flags of the optional groups in different order on 32-bit and 64-bit platforms.
gh-155212: The
--convertersoption of Argument Clinic now accepts file names and can be used with--make. It prints the converters and return converters which the specified files define, instead of the built-in ones.gh-155207: Argument Clinic now supports the
--dry-runand--diffoptions. They list the files which would be changed, or write a unified diff of the changes to the standard output, without modifying any file.gh-64502: Argument Clinic now supports several optional groups on the same nesting level, like in
[y, x,] [n,] attr. Such groups can be omitted independently of each other.gh-64502: Fix Argument Clinic support of parameters with a default value used together with optional groups. Such parameters were always required in the generated parsing code.
gh-154580: Fix
python-gdb.pyraisingUnicodeEncodeErrorwhen pretty-printing a non-ASCIIstrin a locale whose host charset cannot encode it, such as any non-ASCII string in the C locale.gh-154059: Fix the time units in Tachyon flame graph tooltips by accounting for the sampling interval when converting samples to milliseconds.
gh-152384: The CPython Pixi packages are now all accessible at the same
Tools/pixi-packagessubdirectory, rather than atTools/pixi-packages/{variant}as before. Variants are now selected not via subdirectory but viaflags; see https://pixi.prefix.dev/latest/concepts/package_specifications/#extras-and-flags for usage instructions. Thetsan-freethreadingvariant has been renamed totsan_freethreading, while thedefault,asan, andfreethreadingvariants retain their previous names.gh-150258: Update the tooltip on the Tachyon flame graph to show both absolute and relative percentages.
gh-111501: PS1 is no longer exported by venv activate script
Tests¶
gh-109817: Add the
--single-process-per-caseoption to libregrtest to run every test case in a separate process. Test cases from the same test module are run sequentially. This helps to detect order dependencies and environment leaks between test cases.gh-155411: Fix
test.support.subTests()for asynchronous test methods. They were wrapped in a synchronous function, which discarded the coroutine without awaiting it, so the test silently did not run at all.gh-155109: Add
test.support.run_with_limited_c_stack()and use it in tests that exhaust the C stack with a fixed number of recursive calls, so that their outcome no longer depends on the C stack size.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 withulimit -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
_testcapimodule on NetBSD.gh-152548: Add the
test.support.isolation.runInSubprocess()decorator to run a test method orTestCasesubclass in a fresh interpreter subprocess, isolated from the rest of the test run.gh-151626: Fix several tests in
test.test_inspect,test.test_import,test.test_importlib,test.test_py_compileandtest.test_compileallthat failed when the test suite was run withPYTHONPYCACHEPREFIXset. These tests now neutralize the pycache prefix where they assume the default__pycache__bytecode layout.gh-151096: Fix
test_embedfailing when CPython is configured with a split exec prefix (--exec-prefixdiffering from--prefix).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-150387: Fix hang in
test.test_profiling.test_sampling_profiler.test_live_collector_ui.TestLiveModeErrors.test_run_failed_script_liveon slow buildbots. The test now always queues a finalqkeystroke so the live TUI loop exits even when the profiler collects enough samples to enter the post-finished input loop.gh-150114: On Linux, regrtest now logs the total memory usage of all Python processes. Read the private memory in
/proc/pid/smaps. Patch by Victor Stinner.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.
gh-148853: Fix tests failing on FreeBSD in test.support’s in_systemd_nspawn_sync_suppressed() due to unreadable /run directory.
Security¶
gh-155558: Update bundled libexpat to version 2.8.3 for the fix to CVE 2026-72522.
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-152674: The
xml.etree.ElementTree.Elementmethodsfindall(),iterfind()andfind()avoid quadratic behavior when using XPath index predicates ([1],[last()],[last()-N]) on XML documents with many same-tag siblings.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-151544:
Modules/Setup.localis no longer used as a landmark to discover whether Python is running in a source tree, as it could potentially affect actual installs. Thepybuilddir.txtfile is now the sole indicator of running in a source tree.gh-151558: Fixed an vulnerability in the
tarfiledataandtarextraction filters where crafted archives could create a symlink pointing outside the destination directory. This was a bypass of CVE 2025-4330.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
bz2when abz2.BZ2Decompressoris reused after a decompression error. The decompressor now becomes unusable after libbz2 reports an error.gh-150743:
http.clientnow limits the number of chunked-response trailer lines it will read tomax_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 or100 Continueresponses forever, hanging the client even when a socket timeout was in use. Reported by@YLChen-007via GHSA-w4q2-g22w-6fr4.gh-149835:
shutil.move()now resolves symlinks viaos.path.realpath()when checking whether the destination is inside the source directory, preventing a symlink-based bypass of that guard.gh-149698: Update bundled libexpat to version 2.8.1 for the fix for CVE 2026-45186.
gh-87451: The
ftplibmodule’s undocumentedftpcpfunction no longer trusts the IPv4 address value returned from the source server in response to thePASVcommand by default, completing the fix for CVE-2021-4189. As withftplib.FTP, the former behavior can be re-enabled by setting thetrust_server_pasv_ipv4_addressattribute on the sourceftplib.FTPinstance toTrue. Thanks to Qi Deng at Aurascape AI for the report.gh-149474: Fix the binary writer in
profiling.samplingnot 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 thedataextraction 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.expatandxml.etree.ElementTreewhen Python is compiled with libExpat 2.8.0 or later.gh-143927: Normalize all line endings (CR, CRLF, and LF) to LF+TAB when writing multi-line configparser values.
Library¶
gh-155888: Fix
asyncio.WriteTransport.writelines()hanging the transport when the last data chunk is empty.gh-155869: Fix
reorganize()indbm.dumbfailing to persist updated value offsets, which could cause data loss after reopening the database.gh-155717:
multiprocessing’s default start method on systems with non-writeable tempfile filesystem is now “spawn” instead of"forkserver". Patch by Bénédikt Tran.gh-155702: Fix
sqlite3.Blobslice 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-90756:
xml.etree.ElementTree.ElementTree.write()now treats theutf-8-sigencoding asutf-8in the XML declaration.gh-80762: Fix
dir()onunittest.mock.Mockobjects created with a tuple spec: it raisedTypeError. Such spec is now also documented.gh-61366:
http.cookiejar.MozillaCookieJar.save()now writes0in the expiration time field for session cookies, as curl and Wget do. Previously this field was left empty, and such lines were ignored by curl and Wget.gh-153400: On Linux,
os.copy_file_range()andos.memfd_create()now fall back to the raw syscall when the libc Python is built against does not provide the wrapper function, so they stay available on interpreters built against a libc older than glibc 2.27.gh-153400:
osandsignal: Use glibc functions instead ofsyscall():pidfd_open(),pidfd_getfd()andpidfd_send_signal()(glibc 2.36),gettid()andgetdents64()(glibc 2.30), andgetrandom()(glibc 2.25). Patch by Victor Stinner.gh-155519: Avoid a data-race in free-threaded builds when reading and writing context variables from different threads.
gh-155336: Fix error handling in
socket.gethostbyaddr()andsocket.gethostbyname_ex()when hostname resolution fails.gh-118318: Remove the
write_c14n()method ofxml.etree.ElementTree.ElementTreeand the support ofmethod="c14n"inwrite()andtostring(). They never worked and always raisedValueError. Usexml.etree.ElementTree.canonicalize()instead.gh-111331: Closing a
io.BytesIOobject which has exported buffers no longer fails withBufferError. The exported buffers keep the data alive and stay usable. As a result, destroying or garbage collecting such object no longer emits an unraisable exception.gh-155319:
warnings.warn_explicit()now displays the source line taken from the loader of the module whose globals are passed as module_globals. It also no longer raisesIndexErrorif lineno is out of the range of the module source.gh-155236: Add the dedent parameter in
inspect.cleandoc()andinspect.getdoc().pydocno longer dedents documentation strings, so the indentation of the parameter descriptions generated by Argument Clinic is preserved.gh-155009: Fix
argparse.ArgumentParserto preserve the program name fromsys.argv[0]when a named module is executed as the main program without replacingsys.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-155143: Fix
asyncio.shield()leaking the calling task via the await-graph and callbacks when called on a future that never resolves.gh-75008:
csv.Sniffer.sniff()now detects the lineterminator parameter by a majority vote among the line endings of the sample.gh-155051:
decimal.localcontext()now raisesTypeErrorif a keyword argument isNone, as the pure Python implementation already did. Previously the C implementation silently ignored it.gh-155044:
optparse.Valuesobjects now supportcopy.replace().gh-155043:
argparse.Namespaceobjects now supportcopy.replace().gh-155041:
decimal.Contextobjects now supportcopy.replace().gh-155040:
tarfile.TarInfoobjects now supportcopy.replace().gh-155063: Bump the version of pip bundled in ensurepip to version 26.2
gh-155033: CSV dialects (instances of
csv.Dialectsubclasses and dialect objects returned bycsv.get_dialect()) now supportcopy.replace().gh-154936: Fix the pure Python
jsondecoder to report the correct position for invalid literal control characters in JSON strings.gh-154904: Speed up
shutilimport by probing the_bz2,_lzmaand_zstdextension modules instead of importing thebz2,lzmaandcompression.zstdwrappers, which are now only imported when an archive is actually created or extracted.gh-154892: Fix a bug in the C accelerator for
zoneinfowheredatetime.datetimesubclasses returning-1forhour,minute, orsecondcould incorrectly raise aSystemError.gh-154871: Fixed a crash in
asyncio.Task.get_context()when called on an uninitialized task.gh-154848: The
pickleC accelerator now enforces frame boundaries when unpickling, as the pure Python implementation already did. An argument that straddles a frame boundary, or a frame that begins before the previous one has ended, now raisespickle.UnpicklingErrorinstead of being silently read across the boundary. This prevents the loaded data from diverging from thepickletoolsdisassembly of the same pickle.gh-154885:
os.get_terminal_size()now checksisattybefore callingioctl, which reduces log noise on Android.gh-154874: Fix
curses.termattrs()returning a negative value on a terminal that supportscurses.A_ITALIC, which left its result unusable as an attribute mask.gh-151728: Clear the internal
typingcaches from an exit handler. Previously, an extension module that leaked a reference totypingwould also keep every subscripted type alive past interpreter shutdown, including types owned by unrelated extension modules.gh-154791: Fix
asyncio.Future(C implementation) losing the initial exception traceback frames whenFuture.result()is called more than once. Previously, the C implementation cleared the stored traceback after the first call, causing subsequent raises to omit the original raise site. The pure-Python implementation was unaffected.gh-94984: Add the mode parameter to
asyncio.loop.create_unix_server()andasyncio.start_unix_server()to set the permissions of the Unix socket file created for path, applied before the server starts accepting connections.gh-154744: Improve detection of
skipinitialspaceincsv.Sniffer.sniff().gh-154726: Fix
shutil.copyfile()to copy a symbolic link to a special file whenfollow_symlinks=Falseinstead of raisingSpecialFileError.gh-154738: Fix
ExternalEntityParserCreate()not propagating the reparse-deferral setting to the subparser, which leftGetReparseDeferralEnabled()returning an uninitialized value. Patch by tonghuaroot.gh-93251: Fix
UnicodeDecodeErrorinsocketfunctions (such asgetaddrinfo()andgethostbyaddr()) when the localized error message of the C library is not UTF-8: decode it from the locale encoding.gh-148468: Fix a regression in
argparsewhere colorized argument help containing format specifiers did not accept string-like proxy objects.gh-154638: Improve import time of
argparseby lazily importing several dependencies.gh-142035: Fix incorrect wrapping of
argparsehelp text when color is enabled.gh-135736: Fix :
asyncio.TaskGroupto not wrap aGeneratorExitinto aBaseExceptionGroupif it was raised by the body of the task group and none of the tasks in the group raised exceptions.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-154551: Fix
ctypes.util.find_library()returningNonein non-UTF-8 locales.gh-154523: Fixed data-race when calling
io.TextIOBase.detach()in free-threaded build.gh-154199: Make
ctypes.util.find_msvcrt()always returnNonefor compatibility reasons.gh-135736: Fix
asyncio.TaskGroupsilently discarding errors from sibling tasks whenever theasync withblock exits with aSystemExitorKeyboardInterrupt. These errors are now reported vialoop.call_exception_handler()instead of being lost.gh-79366: Fixed a race condition in
logging: if a handler was removed while a record was being emitted, the following handlers of the same logger could be skipped.gh-82535:
logging.handlers.SysLogHandlerno longer fails if the address cannot be resolved when the handler is created. The address is resolved again when a record is emitted.gh-70990:
logging.handlers.SysLogHandlernow accepts abytesaddress of a Unix domain socket, including an address in the abstract namespace. Previously onlystrwas recognized, and abytesaddress raisedValueError.gh-154189: Fixed a potential use-after-free when calling
functools.partial(). Now, when invoking apartial()object, the stored function, positional arguments, and keyword arguments are preserved for the duration of the call in case of reentrancy.gh-73458: Fix
logging.config.listen(): it left the caller waiting for thereadyevent forever if the server could not be started, for example if the port was invalid or already in use. It now also binds to an IPv6 address if the host has no IPv4 address, for example iflocalhostis only aliased to::1.gh-154460: Fix
time.strftime()anddatetime.datetime.strftime()returning a wrong ISO 8601 week number (%V) on OpenBSD.gh-154467: Fixed
pdbremote attaching (python -m pdb -p PID) sending an empty prompt to the client instead of(Pdb)when the target process has an interactive terminal.gh-153970: Calling
str()on asubprocess.CalledProcessErrorno longer raisesTypeErrorwhen itsreturncodeis not an integer, such asNone.gh-154435: Fix
os.posix_fadvise()andos.posix_fallocate()on DragonFly BSD: they raisedOSErrorwith a meaningless error code, because these functions return -1 and seterrnothere.gh-154399: Fix
venvactivation in a non-interactive csh:activate.cshno longer fails when thepromptvariable is not set.gh-154389: Fix
uuid.uuid1()on OpenBSD: it returned a version 4 UUID, becauseuuid_create()generates random UUIDs on this platform.gh-154324: Fix
os.sendfile()on illumos: it no longer reports a successful transfer when the underlying system call failed without writing any data.gh-154307: Fix
tempfile.TemporaryDirectory.cleanup()on DragonFly BSD, where removing a file with theUF_NOUNLINKflag failed withEISDIRinstead ofEPERM.gh-154291: Fix
socket.has_dualstack_ipv6()to returnFalseon platforms such as DragonFly BSD where settingIPV6_V6ONLYto 0 silently has no effect.gh-154283: On DragonFly BSD,
threading.get_native_id()now returns a value that is unique across processes, matching the other platforms.gh-154258: Fix a crash in
mmap.mmap.resize()on NetBSD when growing a shared anonymous mapping.resize()now raisesValueErrorin this case, as it already did on Linux.gh-131565:
ctypes.util.dllist()now works on NetBSD. It is implemented in the_ctypesextension module so thatdl_iterate_phdr()reports all loaded shared libraries: on NetBSD it only reports the link-map group of the calling object, which excluded them when called through ctypes.gh-154225: Fix
os.openpty()on Solaris and illumos: it no longer leaves the pseudo-terminal as the controlling terminal of the calling process.gh-154227: Fix
os.posix_openpt()on OpenBSD, where it rejected theO_CLOEXECflag.gh-139373: Fix
asyncio.subprocess.Process.communicate()losing already-read output when it is cancelled; the output is now retained and returned by a subsequentcommunicate()call. Patch by Kumar Aditya.gh-145030: Fix
asynciowrite pipe transports for named FIFOs on macOS and Solaris. Unread data sitting in the FIFO made the transport misinterpret a poll event as the reader disconnecting, wrongly closing the transport.gh-154176: Fix a crash in
locale.strxfrm()on DragonFly BSD, whosewcsxfrm()does not support the zero size.gh-154836: Fix
subprocess.Popen.wait()raisingTypeError(macOS and other BSDs) orOverflowError(Linux) for very large timeout values such asfloat('inf'), a 3.15 regression in the new event-driven wait. Also fixselect.kqueue.control()maskingOverflowErrorfor out-of-range timeouts asTypeError.gh-154146: Fix accuracy of
math.acospi()for arguments close to 1 on platforms that do not provideacospi()in libm.gh-154086: Store per-thread sample counts in Tachyon flamegraphs so filtering a thread updates frame widths and totals.
gh-154053: Fix compilation of the
sslmodule against LibreSSL, which does not provideSSL_CTX_set1_sigalgs_list()andSSL_CTX_set1_client_sigalgs_list(). Theset_server_sigalgs()andset_client_sigalgs()methods ofssl.SSLContextnow raiseNotImplementedErroron LibreSSL.gh-154002: The pure-Python
pickleunpickler no longer replaces aTypeErrorraised by an old-style instance constructor with a new one carrying the traceback object in itsargs. The original error now propagates, as it already did in the C implementation.gh-154001: Fix
random.binomialvariate()raisingZeroDivisionErrorwhenrandom.random()returns zero.gh-153967:
argparse.ArgumentParser.print_usage()andargparse.ArgumentParser.print_help()won’t silently fail when an invalid file object is specified. Patch by Timothy Poon.gh-153906: Modernize the HTML output of
pydoc: use semantic HTML5 markup and a new style sheet based on the python-docs-theme used by docs.python.org, with dark mode support. Class members inherited from other classes are now collapsed by default.gh-153908: Fix data race when calling
repr()onitertools.countunder the free-threaded build.gh-153896: Deduplicate unhashable args in
typing.Literal.gh-153903: Add
ctypes.util.wrap_dll_function()for creating_CFuncPtrobjects from a function signature.gh-153864: On a wide
cursesbuild,curses.window.insch()now inserts a non-ASCII byte as the character it encodes in the window’s encoding, consistently withaddch(), instead of its code point.gh-153862: On a wide
cursesbuild,curses.window.inch()now returns the locale-encoded byte of a non-ASCII character, matchinginstr(), instead of the low byte of its code point.gh-153856: Add
os.RWF_NOSIGNALconstant for Linux 6.18+.gh-153844:
symtable.symtable()now accepts an AST object, like the builtincompile().gh-146011: Fix a heap-use-after-free in the C implementation of
decimalwhen callingrepr()after deleting theContext.gh-104533: Add
ctypes.util.struct()andctypes.util.CFieldInfofor generating structure types using annotations.gh-153761: Fix cancelling
asyncio.loop.sock_accept()dropping a pending connection.gh-153695: Hashing a
sqlite3.Rowthat contains an unhashable value now raisesTypeErrorinstead ofSystemError. Patch by tonghuaroot.gh-127049: Fix a race condition in
asyncioon Unix whereasyncio.subprocess.Process.send_signal(),terminate()orkill()could signal an unrelated process that was recycled onto the PID of the already-reaped child when ThreadedChildWatcher is used. Patch by Kumar Aditya.gh-83273:
csv.Sniffer.sniff()now deduces the dialect by trial parsing with the actual CSV parser instead of heuristics based on matching isolated fragments and on character frequencies. It can now detect the escapechar parameter, accepts non-ASCII delimiters in the delimiters argument, no longer misdetects the delimiter when the sample contains delimiter characters inside quoted fields, handles samples truncated at an arbitrary point, and no longer takes quadratic time on quoted samples. A sample consisting of a single column of quoted fields now raisescsv.Errorinstead of guessing a delimiter from the content of the fields.gh-153658: Fix
sqlite3.Connection.iterdump()raisingsqlite3.OperationalErrorwhen a table name contains a single quote. Patch by tonghuaroot.gh-98078: Fix
asyncioSSL transports not sending the fatal TLS alert to the peer when the TLS handshake fails or when receiving corrupted data, and not sending theclose_notifyalert to the peer when the TLS shutdown fails. The peer can now tell why the connection was dropped (for example, certificate verification failure or no TLS version in common) instead of seeing the connection abruptly closed.gh-85943: Fix
structfunctions raisingBytesWarningunder the-bbcommand line option when astrformat is used after an equalbytesformat (or vice versa). The internal format cache no longer mixesstrandbyteskeys.gh-153603: Fix a crash in the ISO-2022 decoders when decoding a byte after an unknown charset designation is set via the decoder’s
setstatemethod. Patch by tonghuaroot.gh-153502:
imaplib.IMAP4.copy(),move(),fetch(),store(),search(),sort(),thread()andexpunge()now accept a keyword-only uid argument that selects the correspondingUIDcommand, as a more convenient alternative touid().gh-153494:
imaplib.IMAP4.search(),sort()andthread()(and the correspondinguidcommands) now encodestrsearch criteria to the declared charset, so international search text can be passed as ordinarystr. When charset isNone(as it must be underUTF8=ACCEPT), the criteria are sent using the connection encoding instead. A criterion passed asbytesis sent unchanged, for use with a charset that Python has no codec for.gh-153513: Values of several Tcl object types returned by
tkinterare now converted to the corresponding Python type instead of being wrapped in a_tkinter.Tcl_Obj:index,window,nsNameandparsedVarNameobjects tostr, andpixelscreen distances with no unit suffix tointorfloat.gh-153404:
urllib.robotparser.RobotFileParsernow silently ignores aCrawl-delayorRequest-ratevalue written with non-decimal digits (such asU+00B2 SUPERSCRIPT TWO) instead of raisingValueErrorand aborting the parse of the wholerobots.txtfile.gh-151292: Store the sample count in
profiling.samplingbinary 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 ofOverflowError. Patch by Maurycy Pawłowski-Wieroński.gh-153417: Error messages from
imaplib.IMAP4.select()andimaplib.IMAP4.uid()no longer raiseBytesWarningunder-bbwhen the mailbox or command argument isbytes.gh-153422:
winfo_exists(),winfo_ismapped()andwinfo_viewable()methods oftkinterwidgets andedit_modified()oftkinter.Textnow return aboolinstead of an integer or, depending onwantobjects, a string.gh-49555:
imaplibnow encodes non-ASCII mailbox names as modified UTF-7 (RFC 3501, section 5.1.3) in the default mode, so international mailbox names can be passed as ordinarystr; underUTF8=ACCEPTthey are sent as UTF-8 instead. A name that is not valid modified UTF-7, such as one with a bare&, is now encoded correctly instead of being sent as is. Astrthat is already valid modified UTF-7, or abytesobject, is sent unchanged.gh-153395:
curses.asciipredicates and thectrl()andunctrl()functions now accept acurses.complexchar.ctrl()now returns a non-ASCII argument unchanged instead of masking it to a control character.gh-153290: Fix a data race on the free-threaded build when
io.BytesIO.__setstate__()installs the instance dictionary while another thread concurrently calls a method on the same object.gh-153406:
email.utils.parsedate_to_datetime()now raisesValueErrorinstead ofOverflowErrorwhen the parsed year or timezone offset is out of range, matching its documented behavior.gh-153333: The
readprofilemethod oftkinter.Tknow reads the user’s profile scripts using the encoding declared in the file, instead of the locale encoding.gh-153296: Fix a data race and use-after-free when iterating over an
io.StringIOobject while it is being concurrently mutated. The__next__method now properly acquires the object’s lock.gh-153083: Defer GC tracking of an
array.arrayto the end of its construction. Patch by Donghee Na.gh-153292: Fix data race in repr of
threading.RLockin free-threading build.gh-153291: Fix a data race in
readline.get_completer()andreadline.get_pre_input_hook()on the free-threaded build: the getters read the stored hook without the critical section that the corresponding setters hold.gh-153293: Fix the live sampling profiler TUI keeping stale aggregated opcode statistics after a stats reset.
gh-143990: A
tkinter.font.Fontcreated from a named font, including bycopy(), now copies its configured options rather than the options resolved by Tcl’sfont actual, preserving a size specified in pixels (a negative size).gh-148286: Fix undefined behavior in
compression.zstd.ZstdDecompressor.unused_datawhen a complete frame was decompressed in a single call.gh-153210: Fix crash on
arrayimport under a memory pressure.gh-153521: Add support for structured arguments in
imaplibcommand methods. A message_set and lists of flags or other atoms can now be passed as sequences instead of preformatted strings, and thesearch(),fetch(),sort(),thread()anduid()methods accept a params keyword argument that substitutes and quotes?placeholders.gh-153256: Added the
tk_print()method totkinter.Canvasandtkinter.Textwhich prints the contents of the widget using the native print dialog. It requires Tk 8.7/9.0 or newer.gh-153259: Added the
tkinter.systraymodule which provides theSysTrayIconclass as an interface to the system tray icon and thenotify()function which sends a desktop notification. They require Tk 8.7/9.0 or newer.gh-72880: Added the
tkinter.fontchoosermodule which provides theFontChooserclass as an interface to the native font selection dialog.gh-153200: Fix
math.isqrt()returning an incorrect result for arguments not less than 2**64 that are instances of anintsubclass with an overridden comparison operator.gh-153158: Remove the erroneous width argument of
calendar.HTMLCalendar.formatmonthpage(), which could drop the year from the heading.gh-66788: Add the
utf-7-imapcodec, implementing the modified UTF-7 encoding used for international IMAP4 mailbox names (RFC 3501, section 5.1.3).gh-89869: Add
imaplib.IMAP4.login_plain(), which authenticates using thePLAINSASL mechanism (RFC 4616). Unlikelogin(), it supports non-ASCII user names and passwords.gh-98092: Add
imaplib.IMAP4.id(), a wrapper for the IMAPIDcommand (RFC 2971).gh-153133: Fix a socket leak in
asyncio.loop.create_connection()when the transport cannot be created.gh-153068: Fix
cProfile.Profile.enable()to no longer overwrite errors fromsys.monitoring.gh-153062: Fix a crash when concurrently iterating an
itertools.tee()iterator on the free-threaded build.gh-153056: Fix
string.Templateraising a spuriousValueErrorwhen 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-59396:
tkinter.scrolledtext.ScrolledTextgained a use_ttk parameter to use the themedtkinter.ttkframe and scroll bar instead of the classictkinterwidgets.gh-143921: Narrow the control character check in
imaplibcommands: 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
ZstdFileraisingAttributeErrorinstead ofio.UnsupportedOperationwhen 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 samefeed()call.gh-153009: Fix compilation of
curseson platforms that define thestdscrmacro. Patch by Bénédikt Tran.gh-152851: Prevent a crash when allocation fails while copying a
BLAKE-2s/2bobject. Patch by Bénédikt Tran.gh-54930: Error responses of
http.server.BaseHTTPRequestHandlerto 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-wordGETrequest line) now receives an HTTP/0.9 style response.gh-152997: On platforms providing the C library’s iconv(3) function, the
codecsmodule now exposes every encoding known toiconvfor which Python has no built-in codec. Such an encoding can be used by its name (for example"cp1133") or, to force theiconv-based engine even when a built-in codec exists, with an"iconv:"prefix (for example"iconv:latin1").gh-119592: Fix
concurrent.futures.ProcessPoolExecutorstranding submitted work forever when a worker process exited upon reaching its max_tasks_per_child limit aftershutdown()was called withwait=False: a replacement worker is now spawned and the remaining work executed as documented. If the executor has instead been garbage collected withoutshutdown()(gh-152967), or a replacement worker cannot be started, the remaining futures now fail withBrokenProcessPoolinstead of never resolving. A worker exit racingshutdown(wait=False)can also no longer crash the executor management thread.gh-150579:
concurrent.futuresnow uses lazy imports for its executor submodules instead of a module__getattr__hook.gh-152951:
collections.dequeprevent rare crash when callingextendunder high memory pressure conditions.gh-152912:
sys.addaudithook()now correctly suppresses onlyRuntimeErrorinstead of allExceptionsubclasses when an existing audit hook raises during hook registration. Patch by Yeongu Kim.gh-150880: Normalize non-extended Windows paths before appending the wildcard used by
os.listdir()andos.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
OverflowErrorwith 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
zoneinfoparser. Patch by tonghuaroot.gh-152905: On glibc,
locale.nl_langinfo()now decodes theLC_TIMEitems (such as the month and day names) using the wide locale data, so the result no longer depends on theLC_CTYPEencoding.gh-152586:
tempfile._TemporaryFileWrapperhas been renamed to the publictempfile.TemporaryFileWrapper. The old private name is kept as a deprecated alias and will be removed in Python 3.21.gh-77508: Add
imaplib.IMAP4.move(), a wrapper for the IMAPMOVEcommand (RFC 6851), analogous tocopy().gh-49680: Add the translate_line_endings parameter to
imaplib.IMAP4.append(). By default line endings in the message are translated to CRLF, as before; passingFalsesends the message literal exactly as given, preserving bare CR or LF octets.gh-152718: Fix unbounded memory allocation in the
profiling.samplingbinary profile reader when a file declares more string or frame entries than it contains.gh-108280: Connecting
imaplibto 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 ofimaplib.IMAP4.error: None.gh-151126: Fix a crash caused by failing to set
MemoryErroron allocation failure when passingctypes.Structureorctypes.Unioninstances by value to ctypes foreign functions.gh-63121:
imaplibnow refreshes the cached capability list after a successfullogin()orauthenticate(), using theCAPABILITYresponse sent by the server or, if none was sent, by querying it, so that capabilities that become available only after authentication (such asENABLEon Gmail) are recognized. Capabilities advertised in the server greeting are now also used, avoiding a redundantCAPABILITYcommand.gh-88574:
imaplibno 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 byLIST). Such blank lines are now skipped without swallowing the following line.gh-152502: Detect the
cursesmouse interface (getmouse(),has_mouse(), theBUTTON*constants, and others) and the windowis_*state-query methods with configure capability probes or library macros instead of gating them on ncurses-specific macros. They are now also available with other curses implementations that provide them, such as NetBSD curses and PDCurses (the latter underpinswindows-curses).gh-151842: Fix a crash in
_interpreters.capture_exception()whenMemoryErrorhappens. Patch by Amrutha Modela.gh-40038:
imaplibnow 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
turtlewhen a mouse event handler that moves the turtle is reentered while the screen is being redrawn, for example withscreen.ondrag(turtle.goto). This could previously crash the interpreter.gh-152638: Deprecate
tkinter.filedialog.askopenfiles(). Opening several files at once is error-prone and the returned list cannot be used in awithstatement; iterate over the names returned bytkinter.filedialog.askopenfilenames()and open them one by one instead.gh-152587: In
tkinter, the name parameter of thewait_variable(),setvar()andgetvar()methods and the value parameter ofsetvar()are now required. Their former default values ('PY_VAR'and'1') were not meaningful.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’sawaited_byset oncewait()returns, even for pending futures.gh-110357: Importing
hashlibno 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 clearValueError.gh-152503: Fix
curses.window.in_wch(),curses.window.in_wchstr()andcurses.window.getbkgrnd()returning garbage text whencursesis built against a curses library that does not NUL-terminate thecchar_ttext array (such as NetBSD curses).gh-152356: Fix a hang in
profiling.sampling run --blockingon Windows when the target process exits. The profiler now finalizes binary profiles instead of continuing to sample the exited process.gh-152470: The wide-character
cursesfunctions and methodscurses.window.get_wch(),curses.window.get_wstr(),curses.unget_wch(),curses.erasewchar(),curses.killwchar()andcurses.wunctrl()now also work when Python is not built against a wide-character-aware curses library, on an 8-bit locale, where each character is a single byte in the relevant encoding.curses.ungetch()now also accepts a one-character string, likecurses.unget_wch(); on a wide-character build it can be any character (previously a multibyte character raisedOverflowError).gh-78335: Update the docstrings of
tkinterandtkinter.ttkwidget classes to list all supported widget options, including options added in Tk 9.0 and 9.1.tkinter.Menubuttonandtkinter.Messagepreviously had no option list at all.gh-152431: Fix
asyncio.StreamWriter.start_tls()to keep the linkedStreamReadertransport in sync with the upgraded transport.gh-103878: The
tkinter.filedialogfunctions that return a filename (askopenfilename(),asksaveasfilename()andaskdirectory()) now consistently return an empty string when the dialog is cancelled, instead of an empty tuple orb''on some platforms.askopenfilenames()likewise always returns an empty tuple, andaskopenfiles()an empty list.gh-151126: Fix two crashes in
tkinterandsocketmodules initialization under a memory pressure. Sets missingMemoryError.gh-133031:
curses.textpad.Textboxnow supports entering and reading back the full Unicode range, including combining characters, when curses is built with wide-character support.gh-133031:
curses.textpad.Textboxnow enters and reads back the non-ASCII characters of an 8-bit locale encoding, instead of mangling them with a 7-bit mask.gh-43699: The drag cursor in
tkinter.dndis now changed only once the pointer starts moving rather than on the initial button press, so that a plain click no longer flashes it.gh-50409: Deprecate the tagOrId parameter of
tkinter.PanedWindow.paneconfigure()(and itspaneconfig()alias) in favor of child, for consistency with the other pane methods; it will be removed in Python 3.18.gh-71880:
curses.textpad.Textboxnow lets the lower-right cell of the window be edited. Writing it withaddch()would move the cursor past the end of the window, raising an error and scrolling a scrollable window, so it is now written withinsch(), which keeps the cursor in place.gh-152334: Add the
curses.define_key(),curses.key_defined()andcurses.keyok()key-management functions.gh-152332: Add the
curses.term_attrs()function, the counterpart ofcurses.termattrs()for theWA_*attributes.gh-87904: The
cursestypes and exceptions now report their public module in__module__,repr()andhelp()– for examplecurses.windowinstead of_curses.windowandcurses.panel.errorinstead of_curses_panel.error.gh-152325: Add the
curses.has_mouse()function and thecurses.window.mouse_trafo()method.gh-121249: Deprecate using
'F'and'D'type codes in thestructmodule.gh-152275: The
cursesmodule now raisesOverflowErrorinstead of silently truncating an out-of-range value:curses.color_pair()rejects a color pair number that does not fit in thechtypecolor field, and theattrargument of the character-cell and attribute methods (addch(),addstr(),attron(),attrset()and others) is checked against thechtyperange.gh-83274: Deallocating a
tkinterapplication from a thread other than the one it was created in no longer crashes the interpreter. The underlying Tcl interpreter is leaked instead, and aRuntimeWarningis reported.gh-81954: Deleting a writable, open
zipfile.ZipFilenow emits aResourceWarning. Use as a context manager or callclose()explicitly.gh-152305: Fix the pure-Python
datetime.time.strftime()implementation raisingAttributeErrorfor the year directives. Patch by tonghuaroot.gh-88758:
tkinter.Misc.focus_get(),focus_displayof(),focus_lastfor()andwinfo_containing()now returnNoneinstead of raisingKeyErrorwhen the widget was not created bytkinter(for example a torn-off menu).gh-152260: Add the
cursesfunctionsscr_dump(),scr_restore(),scr_init()andscr_set(), which dump the whole screen to a file and restore it.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-152263: Add the soft-label-key functions to the
cursesmodule:slk_init(),slk_set(),slk_label(),slk_refresh(),slk_noutrefresh(),slk_clear(),slk_restore(),slk_touch(),slk_attron(),slk_attroff(),slk_attrset(),slk_attr(),slk_attr_on(),slk_attr_off(),slk_attr_set()andslk_color().gh-116946: The internal
_tkintertkappandtktimertokentypes now implement the garbage collector protocol, so reference cycles involving a Tcl interpreter or a timer handler can be collected.gh-152258: Add the
curseswindow methoddupwin(), which returns a new window that is an independent duplicate of an existing one.gh-152248: Make the C and pure-Python
zoneinfoparsers 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
tkinterwhen a Tcl command created withcreatecommandwas not explicitly removed before the interpreter was deleted. The command no longer keeps the interpreter alive through a reference cycle.gh-111330: Update pure-Python
io.BytesIOto close cleanly when the data has an export such as amemoryview.gh-152246: Fix the pure-Python
zoneinfoparser accepting an invalid POSIX TZ transition rule with a non-period separator. Patch by tonghuaroot.gh-152233: Add the
curses.complexstrtype, an immutable string of styled character cells (the counterpart ofcurses.complexchar), and thecurseswindow methodin_wchstr()that returns one. The string-cell methodsaddstr(),addnstr(),insstr()andinsnstr()now also accept acomplexstr. Likecurses.complexchar, it works whether or not Python was built against a wide-character-aware curses library.gh-152233: Add the
curses.complexchartype, representing a styled character cell (text, attributes and color pair), and thecurseswindow methodsin_wch()andgetbkgrnd()that return one. The character-cell methods (addch(),bkgd(),border(),hline()and others) now also accept acomplexchar. This works whether or not Python was built against a wide-character-aware curses library; on a narrow build a cell holds a single character representable as one byte in the window’s encoding.gh-152099:
asyncio’sloop.sendfile(..., fallback=False)now consistently raisesasyncio.SendfileNotAvailableErrorfor fallback-only transports, such as SSL/TLS transports, when native sendfile cannot be used. Previously, this case raisedRuntimeError.gh-151496: Fixed
profiling.sampling --geckowith--async-awareby flattening async task stacks before generating Gecko samples.--binarynow rejects--async-awareuntil the binary format supports async task data.gh-152219: Add the
curseswindow methodsattr_get(),attr_set(),attr_on(),attr_off()andcolor_set(), which use a separate color pair argument instead of packing it into the attribute value, and the correspondingWA_*attribute constants.gh-139816: Fix a hang in
tkinteron interactive Python built withoutreadline. 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
tkinteron interactive Python. When a Tcl command running its own event loop (such asvwaitorwait_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
zoneinfoparser accepting a POSIX TZ string with astdabbreviation but no offset. This is invalid per POSIX and now raisesValueError, 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()andfromisoformat()now reject a decimal separator that is not followed by any fractional digit before a timezone designator.gh-151763: Fix crash in
_interpqueues.create()wheMemoryErrorhappens 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
matchandcaseto the list of supported topics byhelp().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-152074: Increase the buffer size to 256 KiB in
asyncio.loop.sendfile()method fallback.gh-152100: Support set operations and nested sets in regular expression character classes, as described in Unicode Technical Standard #18: set difference (
[A--B]), intersection ([A&&B]) and union ([A||B]).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
jsonC accelerator now correctly reports an unterminated string for a\uXXXXescape at the end of the input.gh-152060: Fix
datetime.datetime.fromisoformat()raisingAssertionErrorinstead ofValueErrorfor some malformed strings in the pure-Python implementation, matching the C implementation.gh-152056: Optimize matching of a character set that contains a single character category, such as
[\d]or[^\s]: it is now compiled to a singleCATEGORYopcode, the same as the corresponding\dor\Sescape, instead of being wrapped in anINblock. This speeds up matching and reduces the size of the compiled byte code. Patch by Pieter Eendebak.gh-152033: Optimize matching of character class escapes (
\d,\D,\s,\S,\wand\W) that occur outside a character set: they are now compiled to a singleCATEGORYopcode instead of being wrapped in anINblock. This speeds up patterns such as\d+and reduces the size of the compiled byte code.gh-143990:
tkinter.font.Fontcan now wrap a font description without creating a new named font, by passing it as font withexists=Trueand no name. This avoids a loss of precision inactual(),measure()andmetrics(). Keyword options now override the corresponding settings of the given font instead of being ignored.gh-127802: The deprecated
tkinter.Variablemethodstrace_variable(),trace(),trace_vdelete()andtrace_vinfo()are now scheduled for removal in Python 3.17.gh-126219: Fixed a crash in
tkinter.Tkwhen className contains a non-BMP character and tkinter is built against Tcl/Tk 8.x. Such a name is now rejected with aValueError.gh-101284:
tkinter.OptionMenunow accepts arbitrarytkinter.Menubuttonoptions as keyword arguments and uses them to override its default appearance.gh-143070: Automatically generated
tkinterwidget names now start with"+"instead of"!", so that they can be used as tags in thetkinter.Canvasandtkinter.Textwidgets.gh-151955: Allow more types to be used in the
boundargument totyping.ParamSpecandtyping.TypeVarTuple.gh-151920: Add the
ttk.Style.theme_stylesmethod, wrapping the Tkttk::style theme stylessubcommand, which returns the list of styles defined in a theme.gh-95555: Regular expressions now support Unicode property escapes
\p{...}and\P{...}for properties that the engine can resolve without the unicodedata database: manyGeneral_Categoryvalues, a number of binary properties, the POSIX compatibility classes, and properties derivable from the code point.gh-151910: Added
tkinter.ttk.Treeviewmethods wrapping the enhancedttk::treeviewwidget commands added in Tk 9.1 (and thedetachedquery added in Tk 9.0): item navigation and queries, opening, hiding, sorting and searching of items, and cell focus, selection and tagging. Theexpand()andcollapse()methods (without recursion) also work on Tk older than 9.1.gh-151890: Add the format parameter to the
tkinter.PhotoImage.put()method, the metadata parameter to theput(),read(),write()anddata()methods, and the withalpha parameter to theget()method. The metadata and withalpha parameters require Tcl/Tk 9.0 or newer.gh-151888: Add the
tkinter.PhotoImage.redither()method, wrapping the photo imagereditherTk command.gh-151886: Add the
tkinter.Misc.tk_appname(),tkinter.Misc.tk_useinputmethods()andtkinter.Misc.tk_caret()methods, wrapping thetk appname,tk useinputmethodsandtk caretTk commands.gh-151881: Add the
tkinter.Menu.postcascade()method and thetkinter.Misc.tk_scaling()andtkinter.Misc.tk_inactive()methods, wrapping thepostcascade,tk scalingandtk inactiveTk commands.gh-151878: Add the
validate()method to thetkinter.Entryandtkinter.Spinboxwidgets, forcing an evaluation of the validation command.gh-151876: Add the
tkinter.Canvasmethodsrchars()androtate(), wrapping thercharsandrotateTk canvas commands.gh-151874: Add the
tkintermethodsMisc.winfo_isdark(),Wm.wm_iconbadge()andWm.wm_stackorder(), wrapping thewinfo isdark,wm iconbadgeandwm stackorderTk commands.gh-59396: The
tkinter.filedialog.FileDialogdialog and itstkinter.filedialog.LoadFileDialogandtkinter.filedialog.SaveFileDialogsubclasses, which follow the layout of the classic Motif file selection dialog, were modernized to match its look and feel more closely. They are now built from the themedtkinter.ttkwidgets instead of the classictkinterwidgets, and gained a use_ttk parameter that selects between the classic Tk widgets and the themed ttk widgets. The buttons and field labels gained Alt key accelerators, the default ring follows the keyboard focus, and the Escape key cancels the dialog. The directory and file lists gained a horizontal scrollbar and type-ahead selection. The dialog is now centered over its parent, and the overwrite confirmation ofSaveFileDialoguses a themed message box.gh-86165: Fix
imaplib.Time2Internaldate()to use the local timezone offset fortime.struct_timevalues withtm_gmtoffset toNone, as returned bydatetime.datetime.timetuple(). Contributed by Xiao Yuan.gh-151822: Colorize
exit,quit,copyright,help, andclearas commands in the REPL when typed alone on a line. Patch by Bartosz Sławecki.gh-59396: The
tkinter.simpledialogdialogs were modernized to match the look and feel of the native Tk dialogs.tkinter.simpledialog.SimpleDialogand theaskinteger(),askfloat()andaskstring()dialogs are now built from the themedtkinter.ttkwidgets instead of the classictkinterwidgets; thetkinter.simpledialog.Dialogbase class still defaults to the classic widgets for compatibility. BothDialogandSimpleDialoggained a use_ttk parameter that selects between the classic Tk widgets and the themed ttk widgets.SimpleDialogalso gained bitmap and detail parameters, draws the standard icons with themed images in the ttk version, and accepts mappings of button options as buttons entries, where anunderlineoption adds an Alt key accelerator. The font and wrap length of the message and the detail message are taken from the Tk option database and can be overridden by the application. The dialogs also follow the keyboard conventions of the Tk message box: the default ring follows the keyboard focus, the Return key activates the focused button, and theDialogOK and Cancel buttons gained Alt key accelerators. Several bugs were also fixed.gh-151814: Fix unbounded memory growth in
io.TextIOWrapperwhen repeatedly writing an empty string.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()raisingAssertionErrorinstead ofValueErrorfor an out-of-range month combined with a24:00time.gh-151776: Add
cursesfunctions and window methods that report state which could previously only be set: the window methodsis_cleared(),is_idcok(),is_idlok(),is_immedok(),is_keypad(),is_leaveok(),is_nodelay(),is_notimeout(),is_pad(),is_scrollok(),is_subwin(),is_syncok(),getdelay(),getparent()andgetscrreg(), and the functionscurses.is_cbreak(),curses.is_echo(),curses.is_nl()andcurses.is_raw(). They are only available when built against an ncurses withNCURSES_EXT_FUNCS.gh-151774: Add the
cursesfunctionscurses.alloc_pair(),curses.find_pair(),curses.free_pair()andcurses.reset_color_pairs()for dynamic color-pair management. They are only available when Python is built against a wide-character version of the underlying curses library with extended-color support.gh-151757: The
cursescharacter-cell window methods now accept a full character cell – a spacing character optionally followed by combining characters – in addition to a single integer or byte character. Add the wide-character read methodscurses.window.get_wstr()andcurses.window.in_wstr(), and the functionscurses.erasewchar(),curses.killwchar()andcurses.wunctrl(). On a narrow (non-ncursesw) build the character cell holds a single character without combining marks, representable as one byte in the window’s encoding, andcurses.window.in_wstr()returns its decoded text.gh-151744: Add
curses.nofilter(), which undoes the effect ofcurses.filter().gh-90092: Add support for multiple terminals to the
cursesmodule: the new functionscurses.newterm(),curses.set_term()andcurses.new_prescr(), the corresponding screen object, and thecurses.window.use()method.gh-151675: Add the
sync()andpendingsync()methods oftkinter.Text, wrapping the Tksyncandpendingsyncsubcommands.gh-151674: Add the
edit_canundo()andedit_canredo()methods oftkinter.Text, wrapping the Tkedit canundoandedit canredosubcommands.gh-151627: Fix a crash in
collections.OrderedDictiterators in free-threaded builds when the dictionary is concurrently cleared or updated.gh-151695: Fix a use-after-free in the
cursesmodule. The encoding of the initial screen, used bycurses.unctrl()andcurses.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-151596: Add missing
sizepositional argument to the pure-Python implementation ofio.TextIOBase.readline().gh-151640: Fix a data race in
io.BytesIOin free-threaded builds when whole-buffer reads or peeks, orgetvalue(), share the internal buffer with concurrent writes.gh-151615: Fix
asyncioservers repeatedly logging and rescheduling on a single event loop iteration whenaccept()fails with a resource errors.gh-151613: Fix another way the Tachyon profiler frame cache could produce impossible mixed stack traces when
_PyInterpreterFrameaddresses 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 raisesRuntimeErrorinstead, as iteration does.gh-151497: Opening a
tarfilearchive 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-151485: Fix command quoting in
subprocess.CalledProcessError. Contributed by Benjy Wiener.gh-151436: Fix skewed stack traces in the Tachyon profiler when caching is enabled and when generators and coroutines are profiled, by updating
tstate->last_profiled_frameat 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 anargvitem’s__fspath__()concurrently mutates theargssequence being converted.gh-151390: Colorize
matchin the REPL when followed by a unary+or-operator. Patch by Bartosz Sławecki.gh-151128: Cross-language keyword suggestions are now shown for
SyntaxErrormessages. For example,switch x:suggestsmatch,delete xsuggestsdel,function f():suggestsdef. Contributed by Zang Langyan.gh-151126: Fix crash on unset
MemoryErroron allocation failure inctypes.get_errno().gh-151416: Fix a crash in
os.spawnv()andos.spawnve()when an argv item’s__fspath__()method mutates the argv list during argument conversion.os.spawnv()argument conversion errors other thanTypeError, such as theValueErrorfor an embedded null, are no longer replaced with a genericTypeError.gh-151337: Avoid possible memory leak in
tkinter.con Windows.gh-150285:
pydocnow uses all available space (80 columns) for formatting reprs of module and class data, but ensure that they do not overflow.gh-151126: Fix a crash when
MemoryErrorinos._path_splitroot()was not set properly.gh-149671: Restore compatibility with setuptools
-nspkg.pthfiles in thesitemodule. Injectsitedirvariable in the frame which executes pth code. Patch by Victor Stinner.gh-119710: Fix
asynciosubprocesswait()hanging when the process has exited but one of its pipes is kept open by an inherited child process (so the pipe never reaches EOF).wait()now returns as soon as the process exits, regardless of the pipes’ state.gh-150994: Make type annotations in the private
_colorizemodule resolvable.gh-151295: Fixed a crash (use-after-free) in
bytes.join()andbytearray.join()that could occur if an item’s__buffer__()concurrently mutates the sequence being joined. The mutation is now reported as aRuntimeErrorinstead.gh-109940: Fix Windows
venvactivation incmd.exeto respectVIRTUAL_ENV_DISABLE_PROMPT.gh-117807: Fix
mimetypesinitialization from MIME map files containing invalid UTF-8 bytes.gh-151179: Fix a pidfd leak in
_PidfdChildWatcheron Linux: the watcher no longer leaks the process file descriptor whenwaitpid()fails with an error other thanChildProcessError.gh-80384:
weakref.ref()andweakref.proxy()now raiseTypeErrorif the callback argument is not callable orNone.gh-150771: Fix
emailmessages created withshift_jisoreuc-jpcharsets.set_content()now stores the payload using the output charset (iso-2022-jp) so printing the message no longer raisesUnicodeEncodeError.gh-150285:
pydocnow wraps long single-line summary in text output.gh-151039: Fix a crash when static
datetimetypes outlive the_datetimemodule.gh-151042: Fixed venv exporting mixed path styles to PATH on Windows inside fish (via Cygwin, MinGW or MSYS2)
gh-151021: Fix
mmap.mmap.find()andrfind()to return-1when searching for an empty subsequence with a start position past the end of the mapping.gh-151022: Fix
_remote_debuggingstack traces for code objects with large line tables.gh-150994: Make the type annotations in the private
_colorizemodule resolvable.gh-62825: Encodings “KS_C_5601-1987”, “KS X 1001”, etc are now aliases of “CP949” instead of “EUC-KR”.
gh-150913: Fix
sqlite3.Blobslice assignment to raiseTypeErrorandIndexErrorfor type and size mismatches respectively, even when the target slice is empty.gh-140006: The
venvactivate.fishscript now calls fish builtins throughbuiltinso a user function that shadows./source,echo,printf,set_color, orfunctionscan no longer hijack the virtual environment prompt or break exit-status reporting.gh-143008: Fix race conditions when re-initializing a
io.TextIOWrapperobject.gh-150889: Speed up
unicodedata.normalize()for the NFC and NFKC forms of non-ASCII text up to a factor 2.gh-150898: Unconditionally assume
ssl.SSLContext.keylog_filenameexists.gh-150886: Remove the private, undocumented function
importlib._bootstrap._object_name(). It had no caller afterload_module()and its deprecation warnings were removed fromimportlib.gh-150583: Correctly set the default compression level in
compression.zstdwhen passing a digested dictionary during compression.gh-150866: Fix
asyncio.loop.shutdown_asyncgens()to report anyBaseExceptionraised during asynchronous generator cleanup.gh-150662: Fix the
--geckocollector inprofiling.samplingthat 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-150820: Speed up
json.dumps()for small documents. Patch by Bernát Gábor.gh-150818: Speed up
logging.getLogger()with a lock-free fast path that returns an already-registered logger without acquiring the logging lock. Patch by Bernát Gábor.gh-150817: Speed up the
|,&and^operations onenum.Flagmembers. Patch by Bernát Gábor.gh-150750: Fix a race condition in
collections.deque.index()with free-threading.gh-150717: Avoid an unnecessary per-call memory allocation when matching
repatterns that have no capturing groups. Patch by Bernát Gábor.gh-150685: Update bundled pip to 26.1.2
gh-150641: Fix bug where
typing.evaluate_forward_ref()with theSTRINGformat could leak internal names used by the annotation machinery.gh-150942: Speed up
re.findall(),re.sub()andre.subn()by appending result items to the output list without an extra reference-count round-trip (using the internal reference-stealing list append helper).gh-150942: Speed up
json.loads()decoding of arrays and objects by storing parsed values into the result list/dict without an extra reference-count round-trip (using the internal reference-stealing append/insert helpers).gh-150478: Add
show_jitoption todis.disto show JIT entry points in the bytecode. This is useful for visualizing where JIT traces are entered from the interpreter.gh-148932: Fix
profiling.samplingon Windows virtual environments to resolve the actual Python PID from a virtual environment shim.gh-150534: Added trigonometric functions that work in units of half turns, rather than radians. The new functions
math.acospi(),math.asinpi(),math.atanpi(), andmath.atan2pi()return half-turn angles. The new functionsmath.cospi(),math.sinpi(), andmath.tanpi()take half-turn angle arguments. These functions are recommended by IEEE 754-2019 and standardized in C23.gh-150228: The new
site.StartupStateclass lets callers batch-process PEP 829 startup configuration files across multiple site directories before any startup code runs, with publicaddsitedir(),addusersitepackages(),addsitepackages(), andprocess()methods. The signature ofsite.addsitedir()is unchanged from Python 3.14. Thedefer_processing_start_filesargument and theprocess_startup_files()function added earlier in the 3.15 cycle have been removed; usesite.StartupStateinstead.gh-150479:
email.utils.formataddr()now raisesValueErrorwhen the name or address contains a carriage return or line feed, matchingemail.headerregistry.Address. This check can be disabled by passingstrict=False.gh-150449:
sqlite3.Blobnow supports negative-step slices for reading and writing (e.g.blob[9:0:-2]). Previously, such slices would raiseSystemErrororValueError.gh-150406: Fix a possible crash occurring during
socketmodule initialization when the system is out of memory on platforms without a reentrantgethostbyname.gh-150372:
readline: Fix a potential crash during tab completion caused by an out-of-memory error during module initialization.gh-132372: Speed up
logging.config.fileConfig()andlogging.config.dictConfig()when handling many existing loggers.gh-150157: Fix a crash in free-threaded builds that occurs when pickling by name objects without a
__module__attribute whilesys.modulesis concurrently being modified.gh-150175: Fix race condition in
unittest.mock.ThreadingMockwhere concurrent calls could lose increments tocall_countand 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-150077: Fix
tarfile.TarFile.zstopento close the underlying zstd file object when opening the tar archive is interrupted by aBaseExceptionsubclass such asKeyboardInterrupt.gh-149980: Fix
tarfileso that GNU long-name directory entries have all trailing slashes stripped from their names, matching the behavior for short-name entries. Previously, only a single trailing slash was removed.gh-127949: Remove the deprecated
asyncioevent loop policy system. Patch by Kumar Aditya.gh-149816: Fix race condition in
ssl.SSLContext.sni_callbackgh-149189: Revert the changes to
pprintdefaults. Patch by Hugo van Kemenade.gh-79413: Update
dataclasses.make_dataclass()to add a qualname parameter. The qualname parameter will be used to set the__qualname__of the createddataclass.gh-149816: Fix a potential use after free condition in
pickle.dumps()in free-threaded mode when serializing lists.gh-88726: The
emailpackage now uses standard MIME charset names “gb2312” and “big5” instead of non-standard names “eucgb2312_cn” and “big5_tw”.gh-53144: The
emailpackage now supports all aliases of Python codecs and uses MIME/IANA names for all IANA registered charsets.gh-149571: Fix the C implementation of
xml.etree.ElementTree.Element.itertext(): it no longer emits text for comments and processing instructions.gh-146406: Add cross-language hints for
.clear()ontuple,frozenset, andfrozendict, suggesting the mutable counterpart. Follow-up to gh-146406.gh-149921: Fix reference leaks in error paths of the
_interpchannelsand_interpqueuesextension modules.gh-149891: Add support for more encoding aliases officially registered in IANA.
gh-149819: Fix regression in
site.addsitedir()where.pthfiles were no longer processed in Python subprocesses. This happened becausesite.main()seededknown_pathswith entries inherited from the parent process, causingaddsitedirto skip.pthprocessing.gh-62259: Add support for multiple multi-byte encodings in the
XML parser: “cp932”, “cp949”, “cp950”, “Big5”,”EUC-JP”, “GB2312”, “GBK”, “johab”, and “Shift_JIS”. Add partial support (only BMP characters) for multi-byte encodings “Big5-HKSCS”, “EUC_JIS-2004”, “EUC_JISX0213”, “Shift_JIS-2004”, “Shift_JISX0213”, “utf-8-sig” and non-standard aliases like “UTF8” (without hyphen). The parser now raisesValueErrorfor known unsupported multi-byte encodings such us “ISO-2022-JP” or “raw-unicode-escape” instead of failing later, when encounter non-ASCII data.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-149473: Calling
os.environ.clear()now emitsos._clearenvauditing event. Patch by Victor Stinner.gh-149720: Remove support for undotted ext in
mimetypes.MimeTypes.add_type().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.pthfile containing animportline that calledsite.addsitedir()(or a.startentry point doing the same) could crash withRuntimeError: dictionary changed size during iterationduring site initialization, breaking tools such asuv 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-149609: Raise
DeprecationWarningon usingabc.abstractclassmethod,abc.abstractstaticmethod, andabc.abstractproperty, schedule its removal for Python 3.21.gh-149634: Remove deprecated and unused
tarfile.TarInfo.tarfileattribute.gh-139489: Add
xml.is_valid_text()toxml.__all__.gh-149614: Fix a regression that broke the ability to deepcopy
argparse.ArgumentParserinstances.gh-149600: Remove deprecated
asyncio.iscoroutinefunction()function.gh-149598: Remove support of deprecated strm argument for
logginghandlers.gh-149595: Remove the
sys._enablelegacywindowsfsencoding()function which has been deprecated since Python 3.13.gh-149567: Remove the
shutil.ExecErrorexception which has been deprecated since Python 3.14.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-149436: Improve performance of
inspect.getattr_static().gh-149534: Fix merging of
collections.defaultdictandfrozendict.gh-149537: Remove kw parameters from python version of
functools.reduce()function.gh-80480: Remove deprecated
'u'type code (wchar_t) for thearraymodule. Use'w'format code instead (Py_UCS4, always 4 bytes).gh-149530: Removed
symtable.Class.get_methods()which has been deprecated since 3.14.gh-149528: Remove
annotationlib.ForwardRef._evaludatedeprecated method.gh-149388: Make
asyncio.windows_utils.PipeHandleclosing idempotent.gh-149499: Removed the
sysconfig.expand_makefile_vars()function which has been deprecated since Python 3.14. Use thevarsargument ofsysconfig.get_paths()instead.gh-149489: Fix
ElementTreeserialization 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 valueNone).gh-149319: The
asyncioREPL now ignoresPYTHONSTARTUPandPYTHON_BASIC_REPLwhen-Eor-Iis used. Patch by Jonathan Dung.gh-149464: Add
os.pidfd_getfd()for duplicating a file descriptor from another process via a pidfd. Available on Linux 5.6+. Patch by Maurycy Pawłowski-Wieroński.gh-149056: Fix
json.load()not forwarding the array_hook argument tojson.loads(). Patch by Thomas Kowalski.gh-149046:
io: Fixio.StringIOserialization: no longer callstr(obj)onstrsubclasses. Patch by Thomas Kowalski.gh-118158: Ensure py_compile CLI error messages end with a newline. Contributed by Xiao Yuan.
gh-148954: Fix XML injection vulnerability in
xmlrpc.client.dumps()where themethodnamewas not being escaped before interpolation into the XML body.gh-148441:
xml.parsers.expat: prevent a crash inCharacterDataHandler()when the character data size exceeds the parser’sbuffer size.gh-119670: Add keyword-only parameter force to
shlex.quote()to force quoting a string, even if it is already safe for a shell without being quoted.gh-92455: Fix
mimetypesto prefer case-sensitive matches for suffix mappings and MIME type suffixes before falling back to case-insensitive matches. Contributed by Xiao Yuan.gh-148736: Fix a latent
AttributeErrorinasynciocall-graph capture when walking an async generator’sag_awaitchain: the walker referencedcr_frameinstead ofag_frame.gh-148665: socket.shutdown function is now enabled for Emscripten builds. However, if the runtime does not implement the shutdown syscall, it will show “Function not implemented” error.
gh-147950: Bind
yank-argto M-_ in the REPL.gh-146452: Fix segfault in
picklewhen pickling a dictionary concurrently mutated by another thread in the free-threaded build.gh-47005: Fix
urllib.request.AbstractHTTPHandler.do_open()to give regular headers set viaadd_header()priority over unredirected headers, consistent withget_header()andheader_items().gh-145107: Simplify
asyncio.staggered_raceby usingeager_start=False.gh-140729: Fix a pickling error in the
cProfilemodule when profiling a script that usesmultiprocessing.Processwith thespawnandforkserverstart methods.gh-143988: Fixed crashes in
socket.socket.sendmsg()andsocket.socket.recvmsg_into()that could occur if buffer sequences are concurrently mutated.gh-143008: Fix crash in
io.TextIOWrapperwhen reentrantio.TextIOBase.detach()is called reentrantly from the underlying buffer.gh-81881:
shutil.copyfile()now raisesSpecialFileErrorfor sockets and device files.gh-140924: Add
locale.localize(),locale.delocalize()and platform-specific locale constants from the_localemodule tolocale.__all__.gh-115634: Fix a deadlock in
concurrent.futures.ProcessPoolExecutorwhen usingmax_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-140344: The classes
ast.slice,ast.ExtSlice,ast.Index,ast.Suite,ast.AugLoad,ast.AugStore, andast.Param, deprecated since Python 3.9, now issue deprecation warnings on use. They are now scheduled for removal in Python 3.21.The
dimsproperty ofast.Tupleobjects, deprecated since Python 3.9, now issues a deprecation warning when accessed. The property is scheduled for removal in Python 3.21. Use the (non-deprecated)eltsproperty ofast.Tupleobjects instead.The deprecated global names are also no longer imported by
from ast import *.gh-140326: Fix the
asyncioREPL namespace so that relative imports no longer resolve against theasynciopackage and__file__is no longer set.gh-139398: Add supported
_sunder_names to thedir()method of theenummodule to support them in REPL autocompletion.gh-139819:
rlcompleter: Avoid suggesting attributes that are not accessible on instances (e.g., Enum members showing__name__). Patch by Peter (ttw225).gh-79638: Disallow all access in
urllib.robotparserif therobots.txtfile is unreachable due to server or network errors.gh-86533: The
os.makedirs()function andpathlib.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 foros.makedirs().gh-64192: Add the optional
buffersizeparameter tomultiprocessing.pool.Pool.imap()andmultiprocessing.pool.Pool.imap_unordered()to limit the number of submitted tasks whose results have not yet been yielded. If the buffer is full, iteration over the iterables pauses until a result is yielded from the buffer. To fully utilize pool’s capacity when using this feature, set buffersize at least to the number of processes in pool (to consume iterable as you go), or even higher (to prefetch the nextN=buffersize-processesarguments).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.errorexception when creating a file withgzip.GzipFileor compressing data withgzip.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 range0to2**32-1.gh-68164: Fix
zipfile.ZipFile.writestr()so it sets the “regular file” bit by default.gh-46927: Prevent
readlinefrom overriding theCOLUMNSandLINESenvironment variables, as values are not updated on terminal resize.gh-72902: Optimize (~x1.4 speedup)
fractions.Fraction.from_decimal()andfractions.Fraction.from_float()forDecimalandfloatinputs, respectively. Patch by Sergey B Kirpichev.gh-128110: Fix bug in the parsing of
emailaddress 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-129382: The
venv.EnvBuilderandvenv.create()APIs now use the platform-dependent default for symlinks fromvenv’s command-line interface.gh-107398: Fix
tarfilestream mode exception when process the file with the gzip extra field.gh-121109: Fix
tarfileperformance issue when reading archives in streaming mode (e.g.r|*).gh-120665: Fixed an issue where
unittestloaders would load and instantiateunittest.TestCase-derived subclasses that are also abstract base classes, which can’t be instantiated.gh-115988:
lzmaadds constants to support the newer BCJ filters for ARM64 and RISC-V.gh-108518: The iterator returned by
concurrent.futures.Executor.map()is no longer automatically closed if a function call raises an exception. Use methodclose()to explicitly close the iterator.gh-113329: Fix
OSErrorbeing raised when trying to run doctests on a class objects in the REPL. Patch by Sten Wessel.gh-105708: Accept an uppercase V prefix in IPvFuture addresses in
urllib.parse.urlsplit().gh-103925: Fix
csv.Sniffer.sniff()for a sample with\r\nline endings in which a quoted field ends a line: a letter could be detected as the delimiter.gh-60055: Let
urllib.robotparser.RobotFileParseraccept aurllib.request.Requestobject as well as a url string when setting a robots.txt url.gh-102967: A bug in
doctest._SpoofOut.truncate()was causing None to be passed toStringIO.seek()when no size was given. A simple fix skips the seek call when no size is given so the buffer can be truncated from the current position.gh-91099:
imaplib.IMAP4.login()now raises exceptions withstrinstead ofbytes. Patch by Florian Best.gh-82039:
http.cookiejar.FileCookieJar.load()now checks the first, format signature line in a case-insensitive manner. Patch by Ashley Harvey.gh-101267: When a worker process terminates unexpectedly,
concurrent.futures.ProcessPoolExecutornow sets a separateBrokenProcessPoolexception on each pending future instead of sharing a single instance among them all. Sharing one exception produced malformed tracebacks: eachFuture.result()call re-raised the same object, appending another copy of the traceback to it.bpo-46375: Add
io.BytesIO.peek()method to read without advancing position.bpo-47216: Added mtime option to
gzip.open(), which will be passed to the constructor ofGzipFile.gh-70758: Creating a new
turtlescreen after the previous one was closed no longer raisesturtle.Terminatoron the first turtle command.bpo-45509: Gzip headers are now checked for corrupted NAME, COMMENT and HCRC fields.
gh-75245:
socket.socket.makefile()now supports line buffering (buffering=1) in text mode, asopen()does and as it worked in Python 2. Previously it silently used block buffering. In binary mode it now emits aRuntimeWarningand uses the default buffer size, also asopen()does.bpo-44012: The
explodedattribute ofipaddress.IPv6Addressandipaddress.IPv6Interfacenow supports addresses with a scope ID (link-local addresses). Previously the former raisedAddressValueErrorand the latter omitted the scope ID.bpo-40469:
TimedRotatingFileHandlernow uses the creation time instead of the last modification time of an existing log file as the basis for the first rotation after handler creation, if supported by the OS and file system. This allows it to be used in short-running programs that start and end before the rotation interval expires.bpo-42861: Add
next_network()andnext_network(). Patch by Faisal Mahmood.gh-84687: The
os.exec*functions now set thefilenameattribute of the raisedFileNotFoundErrororNotADirectoryErrorto the program name passed by the caller.gh-83869: Fix
tarfilereading an archive with a GNU sparse 1.0 member whose size is set in the pax extended header. The offset of the next header was computed from the offset of the data, which is already past the sparse map, and from the size of the member, which can be the apparent size of the sparse file. All following members were unreachable.gh-61366:
http.cookiejar.MozillaCookieJarnow reads session cookies written by curl and Wget, which use0in the expiration time field. Contributed by Jérémie Detrey.
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
.txtextension 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
idlelibdirectory to the path of the IDLE user process. User code run in IDLE can no longer importidlelibsubmodules as top-level modules, such asimport 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_CLASSwindow property of IDLE’s windows toIdleon X11, so that window managers group and label them correctly instead of using the defaultToplevel.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.
bpo-6699: Warn the user if a file will be overwritten when saving.
Documentation¶
gh-118150: Clarify in the
difflibdocumentation what junk actually does, its drawbacks, and how to control it.gh-86726: Greatly expand the
tkinterdocumentation 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 andversionadded/versionchangedinformation.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 ofos.rename()since nonatomic move might be used even if the files are on the same filesystem. Patch by Fang Li
Core and Builtins¶
gh-155752: Fix a crash when a
types.GenericAliasargument gains a__typing_subst__hook after the alias parameters have been cached.gh-155504: Fix a crash when thread state creation fails before the thread state is fully initialized.
gh-129752: Don’t update adaptive counters in the free-threaded build when thread-local bytecode is disabled (
-X tlbc=0). Patch by Donghee Na.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-155315: Fix
marshalso that afrozendictreferenced more than once in the serialized data round-trips correctly, instead of failing to load withValueError. Patch by tonghuaroot.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-154701: Fix an infinite loop in JIT when a
FOR_ITERside exit links an executor back to itself.gh-154937: Fix a data race on thread handle identifiers when
_thread._shutdown()runs concurrently with the startup of non-daemon threads in the free-threaded build.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
casestatements, an extraneous+sign (for example,1++1jor1-+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.TaskraisingAttributeErrorwhen created witheager_start=Trueand no explicit loop argument.gh-154044: Fix a data race on a descriptor’s
__qualname__cache in the free-threaded build.gh-154196: Improve
AttributeErrormessages from unresolved lazy imports. Patch by Bartosz Sławecki.gh-153809: Fix interpreter crash while deallocating objects of
asyncio.Taskon free-threaded builds. Contributed by Sergey Miryanov.gh-154429: Slightly speed up deallocation of objects that are not tracked by the garbage collector, such as
int,floatandstr.gh-154275: Fix a crash when getting deeply nested
__parameters__from atypes.GenericAliasobjects.gh-154043: Fix a data race when iterating a shared
types.GenericAliasiterator from multiple threads under the free-threaded build.gh-154014: Fix a JIT assertion during interpreter shutdown by initializing
vm_datafields for cold executors that bypass_Py_ExecutorInit().gh-153932: Fix thread safety issue in the
__reduce__method ofenumerate.gh-153881: Fix potential data race when calling
__getstate__()under the free-threaded build.gh-153785:
AttributeError: The default error message is now generated fromnameandobjattributes when both are set and the exception was constructed with no positional arguments, or with a single positional argument equal toname. Patch by Bartosz Sławecki.gh-152075: Reduced lock contention during LOAD_GLOBAL bytecode specialization under free threading.
gh-78959: Add the order parameter to
memoryview.cast(). Withorder='F'it creates a zero-copy Fortran-contiguous (column-major) view of a flat buffer, mirroring the order argument ofmemoryview.tobytes().gh-153570: Fix a use-after-free in
bytearray.take_bytes()when the argument’s__index__()method resizes the bytearray. Patch by tonghuaroot.gh-153568: Speed up the parser by caching repeated identifiers during a parse.
gh-153568: Speed up the parser by letting memoization lookups that cannot match return immediately.
gh-153419: Fix multiple
bytearraycrashes and reference leaks caused by skipping__init__()and broken state setup code.gh-153298: Fixes a data race in
types.GenericAlias__parameters__initialization on free-threading builds.gh-153205: Fix a potential
SystemErrorduring vector calls when memory allocation fails. AMemoryErroris now raised instead.gh-153171: Improve syntax error messages for misplaced
notafter an operator in contexts where a generic “invalid syntax” error was previously reported, such as1 << 2 + not xand1 * + not x.gh-153236: Propagate exceptions raised while importing lazy submodules instead of reporting them as missing attributes.
gh-102960: Frame objects now support
weak references. Patch by Łukasz Langa.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
_interpchannelschannel. Now aMemoryErroris correctly raised.gh-152405: Do not expose the internal mapping of
types.MappingProxyTypewhen 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 originaldictinstance, but its copy, when dealing with custom types.gh-152492:
collections.OrderedDictupdatemethod can now acceptfrozendictas an argument.gh-152375: Fix undefined behaviour when a
sys.monitoringcallback raised an exception while the program was following a branch or loop.gh-152192: Fix a truncated
opargbeing passed to JIT trace initialization for aJUMP_BACKWARDwith anEXTENDED_ARG.gh-152235: Defer GC tracking of
set.intersection(),set.difference(),set.symmetric_difference(),set.union()andset.__sub__. Patch by Donghee Na.gh-152235: Defer GC tracking of a
setorfrozensetto 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 thefrozendictin the garbage collector once the dictionary is fully initialized. Patch by Donghee Na and Victor Stinner.gh-151763: Fixes possible crash on
types.CodeTypedeallocation.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()andast.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 whosetp_newslot isNULL. Such metaclasses are now rejected withTypeErrorinstead of causing a NULL pointer dereference.gh-151895: Fixed a crash in
marshal.loads()when an allocation failed while loading a reference-tracked dictionary; it now raisesMemoryError.gh-151905: Fix OOM error handling in
PyFrame_GetBack()to propagate exceptions instead of masking them as None.gh-151907: Avoid creating
listobjects in comprehensions when the comprehension is not used as a value.gh-151773: Fix a crash in
contextvars.ContextVar.set()when memory allocation fails.gh-151665:
inspect.signature()now works on the lazy evaluators of type aliases and type parameters instead of raisingValueError.gh-151672: Fix an inconsistency where calling
__lazy_import__with a stringfromlistwould return atypes.LazyImportTypethat resolves to the named member, rather than the module being imported.gh-151722: Defer GC tracking of
frozendictto end of construction. Patch by Donghee Na.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-151646: Fix a data race in free-threading builds between
gc.get_stats()and a concurrent garbage collection cycle. Access to the per-generation statistics is now serialized with a mutex so the reader observes a consistent snapshot.gh-151126: Fix a crash when sharing
memoryviewobjects between interpreters fails due to running out of memory. It now raises a properMemoryError.gh-151644: Fix a data race in
sys.setdlopenflags()andsys.getdlopenflags()when called concurrently in the free-threaded build. The underlying_PyImport_GetDLOpenFlagsand_PyImport_SetDLOpenFlagsfunctions now use atomic load/store operations.gh-151126: Avoid possible crash in
_winapi.cwhere a device has no memory left. Now it properly raises aMemoryError. Patch by Ivy Xu.gh-151126: Avoid possible crash in
getpath.cwhere a device has no memory left. Now it properly raises aMemoryError. Patch by Ivy Xu.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 explicitglobalsargument 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 problemmessage. 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-151218:
PyConfig_Set()andsys.set_int_max_str_digits()now replacesys.flags(create a new object), instead of modifyingsys.flagsin-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 withPYTHONMALLOCset tomimalloc.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,
_interpchannelsmodule,_winapi.CreateProcess()function.Now these places raise proper
MemoryErrorerrors.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-151029: On Linux, fix
sys.remote_exec()unable to find remote writable memory whenlibpythonreplaced on disk.gh-150942: Speed up frame local variable item collection by appending result pairs to the output list without an extra reference-count round-trip (using the internal reference-stealing list append helper). Patch by Omkar Kabde.
gh-150988: Fix a reference leak in
OSErrorwhen attributes are set beforesuper().__init__().gh-145685: The internal method cache used for types is now a per-type cache instead of a global per-interpreter one, improving performance and reducing cache misses. Patch by Kumar Aditya.
gh-146495: Improve
SyntaxErrormessage for&&and||operators, suggestingand/&andor/|respectively.gh-148874: Ignore interrupts immediately after calling the
__enter__method of a context menager in awithstatement. This ensures that the__exit__method is always called in awithstatement.gh-150459: Fix
SyntaxErrorerror message forfrom x lazy import y. RaiseSyntaxWarningonfrom . lazy import x(with whitespace between the dots and a module namedlazy).gh-150858: Fix a data race while changing
__qualname__of a type concurrently on free-threaded builds.gh-150723: Fix perf jitdump timestamps on macOS. Events were stamped using
CLOCK_MONOTONIC, but macOS profilers timestamp their samples withmach_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_idfield of theJR_CODE_LOADrecord 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
SystemErrorwhen compiling a class-scope comprehension containing alambdathat 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.modulescache and create duplicate module objects.gh-144774: Fix data race in
BaseExceptionwhen 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-150374: Fix double release of the import lock on lazy import reification errors.
gh-148613: Fix a data race in the free-threaded build between
gc.set_threshold()and garbage collection scheduling during object allocation.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
unicodedatamodule was removed fromsys.modulesand garbage-collected between calls that decode\N{...}escapes or use thenamereplacecodec error handler.gh-150207: Fix a crash when a memory allocation fails during tokenizer initialization. A proper
MemoryErroris now raised instead.gh-150107:
asyncio:sendfile()andsock_sendfile()event loop methods now callfile.seek(offset)if file has aseek()method, even if offset is0(default value).gh-150208: Avoid double-quoting string values from
pyconfig.hinsysconfigdatavariables.gh-150146: Fix a crash on a complex type variable substitution.
from typing import TypeVar; memoryview[TypeVar("")][*typing.Mapping[..., ...]]used to fail due to missingNULLcheck on_unpack_argsC function call.gh-148587:
sys.lazy_modulesis now a set instead of a dict as initially spelled out in PEP 810.gh-150027: Improve performance of
frozensetobjects by avoiding copies during construction.gh-150042: Fix refleak in queue.SimpleQueue.put if memory allocation fails.
gh-149590: Fix crash when faulthandler is imported more than once.
gh-138325: Speed up converting a list to a tuple in the
tuple(genexpr)fast path and in starred tuple displays (e.g.(*a, *b)) by stealing the list’s items into the tuple instead of copying them.gh-149816: Fix a race condition in
_PyBytes_FromListin free-threading mode.gh-149816: Fix a race condition in
memoryviewwith free-threading.gh-149807: Fix
hash(frozendict): compute the hash of each(key, value)pair correctly. Patch by Victor Stinner.gh-149805: Fix a
SystemErrorwhen compiling a compiling__classdict__class annotation. Found by OSS-Fuzz in #512907042.gh-149738:
sqlite3: Disallow removingrow_factoryandtext_factoryattributes 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-127727: Warn when running a virtual environment created for a different minor Python version than the current interpreter, and suggest using
python -m venv --upgrade.gh-148871: The empty tuple
()is now loaded viaLOAD_COMMON_CONSTANTinstead ofLOAD_CONST, removing it from per-code-objectco_conststuples.gh-149689: Fix missing error propagation in parser action helpers when memory allocation fails. Patch by Thomas Kowalski.
gh-149676: Fix
frozendict | frozendicthash.gh-148829:
sentinelobjects now support arepr=argument and their__module__attribute is writable.gh-149642: Allow imports inside
exec()calls within functions underPYTHON_LAZY_IMPORTS=all.gh-144957: Fix lazy
fromimports of module attributes provided by module-level__getattr__.gh-149459: Fix a crash in the JIT optimizer when a specialized
LOAD_SPECIALguard deoptimized after inserting the syntheticNULLstack entry.gh-149321: Do not support
noneas a lazy imports mode.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-148817: Fold large constant list and set literals used as the iterable of a
forloop orin/not intest into a constanttupleorfrozenset, restoring an optimization previously done by the AST optimizer that was lost when constant folding moved to the CFG.gh-148825: Fix build error if specialization is disabled.
gh-148450: Fix
abc.register()so it invalidates type version tags for registered classes.gh-75723: Avoid re-executing
.pthfiles whensite.addsitedir()is called for a known directory.gh-145857: The
DELETE_GLOBALopcode is now replaced withPUSH_NULL; STORE_GLOBAL.gh-145855: The
DELETE_ATTRopcode is now replaced withPUSH_NULL; STORE_ATTR.gh-145854: The
DELETE_NAMEopcode is now replaced withPUSH_NULL; STORE_NAME.gh-91484:
memoryview.cast()now allows casting from N-D to 1-D for F-contiguous.gh-85260:
compile()now raisesValueErrorinstead 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".bpo-38131: Produce more meaningful messages when compiling AST objects with wrong field values. Patch by Batuhan Taskaya.
C API¶
gh-152105: Remove the
PyUnstable_ExecutableKindsarray, as well as the macrosPyUnstable_EXECUTABLE_KIND_SKIP,PyUnstable_EXECUTABLE_KIND_PY_FUNCTION,PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION,PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTORandPyUnstable_EXECUTABLE_KINDS, from the C API.gh-152132: Fix
Py_RunMain()to return an exit code, rather than callingPy_Exit(), when running a script, a command, or the REPL. Patch by Victor Stinner.gh-145633:
PyFloat_Pack8()andPyFloat_Unpack*functions are no longer guaranteed to always succeed on CPython.gh-153300:
PyConfig_Set()now also set global configuration variables. For example,PyConfig_Set("inspect", value)now also setsPy_InspectFlag. Patch by Victor Stinner.gh-141510: Add
frozendictto the fast paths ofPyMapping_GetOptionalItem(),PyMapping_Keys(),PyMapping_Values(), andPyMapping_Items().gh-123619:
PyUnstable_Object_EnableDeferredRefcount()now returns0if the object is not tracked by the garbage collector: ifgc.is_tracked()is false. Patch by Victor Stinner.gh-149044: Improved error message when specifying non-type base classes in
Py_tp_bases,Py_tp_base, and bases argument toPyType_FromMetaclass()and otherPyType_From*functions.gh-80384:
PyWeakref_NewRef()andPyWeakref_NewProxy()now raiseTypeErrorif the callback argument is not callable,None, orNULL.gh-150907: Fix
dynamic_annotations.hheader file when built with C++ and Valgrind: addextern "C++" scopefor the C++ template. Patch by Victor Stinner.gh-150671: Deprecate these C-API functions:
PyGen_New(),PyGen_NewWithQualName(),PyCoro_New(), andPyAsyncGen_New(). Schedule them for removal in 3.18gh-149725: Add
PySentinel_CheckExact()for exactsentineltype tests to accompany the existingPySentinel_Check().gh-145235: Made
PyDict_AddWatcher(),PyDict_ClearWatcher(),PyDict_Watch(), andPyDict_Unwatch()thread-safe on the free threaded build.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.bpo-32414:
PyCapsule_Import()now imports submodules if needed. Previously names likepackage.module.attributeworked only ifpackage.modulewas already imported.
Build¶
gh-90604:
configureno longer setsMULTIARCHon OpenBSD platforms.gh-154271: Define
_XOPEN_SOURCE=600on Solaris and illumos, so that on illumos the socket module is built withsendmsg(),recvmsg()and theCMSG_*helpers. This also enables theforkservermultiprocessingstart method.gh-154136: Fix building the
mathmodule on FreeBSD. Define_ISOC23_SOURCEto make the C23 library declarations (such assinpi()inmath.h) visible.gh-154070: Build the
cursesmodule against a wide-character capable ncurses even when it is not namedncursesw– for example the pkgsrc ncurses on NetBSD and illumos, or the system ncurses on macOS. Such a library previously produced a narrow build.gh-152902: Added Intel
icxcompiler support toconfigure.ac. Contributed by High Performance Kernels LLC.gh-154055: The
cursesandcurses.panelmodules can now be built against a curses library that lacks the X/Openattr_tand soft-label attribute functions,scr_set()orresizeterm()– such as the native SVr4 curses of illumos and Solaris. These functions are probed and used only when present.gh-136687: Add the
--with-cursesoption to configure to select the curses backend (ncursesw,ncursesor the system’s nativecurses) or, as--without-curses, to exclude thecursesandcurses.panelmodules from the build.gh-126877: Fix the configure check for Tcl/Tk which could wrongly succeed with optimizing compilers when the libraries are missing.
gh-153511: Removes the legacy MSI and Nuget build scripts, the legacy
py.exelauncher (now replaced by the Python install manager), and adds aPC/layoutreadme.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
decimalC extension (_decimal) when it is built withEXTRA_FUNCTIONALITY.Context.apply()called the internal_applyhelper using its pre-Argument-Clinic signature; the call is now made through the generated_implfunction.gh-152769: Enable the perf profiler trampoline on Alpine Linux with the musl C library on
x86_64andaarch64. 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
cursesmodule now detects its optional functions with configure capability probes instead of assuming ncurses, so it builds against narrow (non-wide) ncurses and other curses implementations such as NetBSD curses, exposing exactly the functions they provide.gh-152240: Fix C stack unwinding tests on Linux LoongArch builds by teaching the manual frame pointer unwinder to recognize the LoongArch frame layout.
gh-151163: Updated Android build to include SQLite version 3.53.2.
gh-115119: Fix the detection of libmpdec header when no .pc files are available.
gh-148294: Corrected the use of
AC_PATH_TOOLinconfigure.acto allow a C++ compiler to be found onPATH.gh-131372: Add a
--with-build-details-suffixconfigure flag to allow Linux distributions that co-install multiple versions of Python in the same tree to avoidbuild-details.jsonclashes.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.
gh-148832: Fix
--enable-boltbuild by switching the default BOLT flag from-icf=1to-icf=0.-icf=1folds address-taken functions and breaks type-slot dispatch, crashing onlistandtupleconcatenation. Patched by Shamil Abdulaev.gh-138800: Fix library name in python3.pc on Android.
gh-139314: Add the
--with-zliband--with-bzip2configure options to select the zlib and bzip2 implementations used to build thezlibandbz2modules. In addition to the default system libraries, they can build against zlib-rs and libbzip2-rs, and--with-zlib=zlib-ngverifies that the detected zlib is zlib-ng.--without-zliband--without-bzip2exclude the modules from the build.gh-115119: Removed bundled copy of the libmpdec, use system library if it’s available. Patch by Sergey B Kirpichev.
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-148252: Fixed string table and sample record bounds checks in
_remote_debuggingwhen decoding certain.pybinputs 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
nbytesparameter withasyncio.AbstractEventLoop.sock_recvfrom_into(). Only relevant for Windows and theasyncio.ProactorEventLoop.gh-148395: Fix a dangling input pointer in
lzma.LZMADecompressor,bz2.BZ2Decompressor, and internalzlib._ZlibDecompressorwhen memory allocation fails withMemoryError, which could let a subsequentdecompress()call read or write through a stale pointer to the already-released caller buffer.gh-148252: Fixed stack depth calculation in
_remote_debuggingwhen decoding certain.pybinputs on 32-bit builds. Issue originally identified and diagnosed by Tristan Madani (@TristanInSec on GitHub).gh-148178: Hardened
_remote_debuggingby validating remote debug offset tables before using them to size memory reads or interpret remote layouts.gh-148169: A bypass in
webbrowserallowed URLs prefixed with%actionto pass the dash-prefix safety check.gh-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
webbrowseron macOS whereosascriptwas invoked without an absolute path. The newMacOSclass uses/usr/bin/opendirectly, eliminating the dependency onosascriptentirely.gh-146333: Fix quadratic backtracking in
configparser.RawConfigParseroption parsing regexes (OPTCREandOPTCRE_NV). A crafted configuration line with many whitespace characters could cause excessive CPU usage.gh-146211: Reject CR/LF characters in tunnel request headers for the HTTPConnection.set_tunnel() method.
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_INITopcode.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 oftyping.TypeAliasTypeinstances.gh-149122: Fix a crash in optimized calls to
all(),any(),tuple(),list(), andset()with an async generator expression argument (for example,tuple(await x for x in y)). These calls now correctly raiseTypeErrorinstead of crashing.gh-149049: Fix stack underflow for
BINARY_OPin 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 exampleimport pkg.sub) and that parent’s__init__.pyitself 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
_PyRawMutexon the free-threaded build where aPy_PARK_INTRreturn from_PySemaphore_Waitcould let the waiter destroy its semaphore before the unlocking thread’s_PySemaphore_Wakeupcompleted, causing a fatalReleaseSemaphoreerror.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
marshallingrecursive code objects,sliceandfrozendictobjects 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, andPyHeapTypeObject.ht_cached_keysoffsets to_Py_DebugOffsetsto support version-independent read-only dict introspection tools.gh-145239: Unary plus is now accepted in
matchliteral 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
memoryviewwhen using the native boolean format (?) incast(). Previously, on some common platforms, callingmemoryview(b).cast("?").tolist()incorrectly returned[False]instead of[True]for any even byte b. Patch by Bénédikt Tran.gh-148418: Fix a possible reference leak in a corrupted
TYPE_CODEmarshal 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
GCMonitorclass with aget_gc_statsmethod to the_remote_debuggingmodule to allow reading GC statistics from an external Python process without requiring the fullRemoteUnwinderfunctionality. 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.GenericAliaswhen the underlying type does not support the vectorcall protocol. Fix possible leaks intypes.GenericAliasandtypes.UnionTypein case of memory error.gh-148208: Fix recursion depth leak in
PyObject_Print()gh-95004: The specializing interpreter now specializes for
enum.Enumimproving performance and scaling in free-threading. Patch by Kumar Aditya.gh-149202: Enable frame pointers by default for GCC-compatible CPython builds, including
-mno-omit-leaf-frame-pointer,-marmon 32-bit ARM, and/or-mbackchainon s390x platforms when the compiler supports them, so profilers and debuggers can unwind native interpreter frames more reliably. Users can pass--without-frame-pointersto./configureto opt out.gh-148014: Accept a function name in
-X presitecommand line option andPYTHON_PRESITEenvironment 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.monitoringevents can now be turned on and disabled on a per code object basis. ReturningDISABLEfrom 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
encodingsis now partially frozen, including thealiasesandutf_8submodules.The
linecacheis now frozen.gh-134584: Optimize and eliminate redundant ref-counting for
MAKE_FUNCTIONin the JIT.gh-143886: Reorder function annotations so positional-only arguments are returned before other arguments. This fixes how
functools.singledispatch()registers functions with positional-only arguments.gh-98894: Restore
function__entryandfunction__returnDTrace/SystemTap probes that were broken since Python 3.11.gh-116021: Support for creating instances of abstract AST nodes from the
astmodule 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 aTypeErrorwhen 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 aDeprecationWarningsince Python 3.13. Patch by Brian Schubert.gh-137293: Fix
SystemErrorwhen searching ELF Files insys.remote_exec().gh-135357: Add support for
socket.SO_PASSRIGHTSon Linux.gh-134690: Removed deprecated in PEP 626 since Python 3.12
codeobject.co_lnotabfromtypes.CodeType.gh-100239: Specialize
BINARY_OPfor concatenation of lists and tuples, and propagate the result type through_BINARY_OP_EXTENDin the tier 2 optimizer so that follow-up type guards can be eliminated.
Library¶
gh-148823: Defer the import of
_colorizeinargparseuntil 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
argparseoption help text to highlight inline code when color output is enabled. Patch by Hugo van Kemenade.gh-148675: Remove
FandDformats fromarrayandmemoryview. Patch by Victor Stinner.gh-149342: Fix
_remote_debuggingbinary 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 raisesRuntimeError("Invalid stack encoding type"), and so thatBinaryWriter.total_samplesafterfinalize()or context-manager exit includes samples flushed from the RLE buffer. Patch by Maurycy Pawłowski-Wieroński.gh-149010: The
inspectmodule CLI now reports as much information as it has available for non-source modules when--detailsis specified, and provides an error message rather than a traceback when--detailsis 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
argparsefor colour helptimeitCLI. 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
pdbcommands inpdbREPL.gh-149296: Add a
dumpsubcommand toprofiling.samplingthat 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_ofc_float_complex,c_double_complexandc_longdouble_complexfromF,DandGtoZf,ZdandZgfor compatibility with numpy. Patch by Victor Stinner.gh-148675: The
array.typecodestype changed fromstrtotupleto support type codes longer than 1 character (ZfandZd). 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()andunittest.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_debuggingmisreading 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, andasynciotask introspection.gh-149189:
pprintnow uses modern defaults:indent=4andwidth=88, and the defaultcompact=Falseoutput is now formatted similar to pretty-printedjson.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 formerexpand=Truelayout. Patch by Hugo van Kemenade.gh-149173: Fix inverted
PYTHON_BASIC_REPLenvironment check inpdb._pyrepl_available.gh-149117: Fix
runpy.run_module()andrunpy.run_path()to set thenameattribute on theImportErrorthey 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.samplingbinary profiles do not contain more unique (thread, interpreter) pairs than declared in the header. Patch by Maurycy Pawłowski-Wieroński.gh-148292:
ssl: Updatessl.SSLSocketandssl.SSLObjectfor OpenSSL 4. The classes now remember if they get assl.SSLEOFError. In this case, followingread(),sendfile(),write(), anddo_handshake()calls raisessl.SSLEOFErrorwithout calling the underlying OpenSSL function. Thanks to that,ssl.SSLSocketbehaves 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(), andfaulthandler.register().gh-148641:
pkgutil.resolve_name()gets a new optional, keyword-only argument calledstrict. The default isFalsefor backward compatibility.gh-148093: Fix an out-of-bounds read of one byte in
binascii.a2b_uu(). Raisebinascii.Error, instead of reading past the buffer end.gh-149083:
dataclasses.MISSINGanddataclasses.KW_ONLYare now instances ofsentinel.gh-148914: Fix memoization of in-band
PickleBufferin the Python implementation ofpickle. Previously, identicalPickleBuffers did not preserve identity, and empty writablePickleBuffermemoized an empty bytearray object in place ofb'', so the following references tob''were unpickled as an empty bytearray object.gh-149026: Add colour to
pickletoolsCLI output. Patch by Hugo van Kemenade.gh-148991: Add colour to
tokenizeCLI 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()andhttp.cookies.BaseCookie.js_output(), which will be removed in Python 3.19. Usehttp.cookies.Morsel.output()orhttp.cookies.BaseCookie.output()instead.gh-146311: Add a canonical keyword-only parameter to the base16, base32, base64, base85, ascii85, and Z85 decoders in
base64andbinascii. When true, encodings with non-zero padding bits (base16/32/64) or non-canonical encodings (base85/ascii85) are rejected. Single-character final groups inbinascii.a2b_ascii85()andbinascii.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.dataclasswithslots=Truethat occurred when a function found within the class had an empty__class__cell.gh-148680:
ForwardRefobjects that contain internal names to represent known objects now show thetype_reprof 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(), andthreading.concurrent_tee().gh-148801:
xml.etree.ElementTree: Fix a crash inElement.__deepcopy__on deeply nested trees.gh-148735:
xml.etree.ElementTree: Fix a use-after-free inElement.findtextwhen the element tree is mutated concurrently during the search.gh-148740: Fix usage for
uuidcommand-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 forZdandZfformats for double complex and float complex. Patch by Victor Stinner.gh-148651: Fix reference leak in
compression.zstd.ZstdDecompressorwhen an invalid option key is passed.gh-148641: PEP 829 (package startup configuration files) implements a new format
<name>.startparallel to<name>.pthfiles, to replaceimportlines in the latter.gh-148639: Implement PEP 800, adding the
@typing.disjoint_basedecorator. Patch by Jelle Zijlstra.gh-148615: Fix
pdbto 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
socketmodule’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:
asynciodebugging tools (python -m asyncio psandpstree) now retry automatically on transient errors that can occur when attaching to a process under active thread delegation. The number of retries can be controlled with the--retriesflag. Patch by Bartosz Sławecki.gh-148518: If an email containing an address header that ended in an open double quote was parsed with a non-
compat32policy, accessing theusernameattribute of the mailbox accessed through that header object would result in anIndexError. It now correctly returns an empty string as the result.gh-148464: Add missing
__ctype_le/be__attributes forc_float_complexandc_double_complex. Patch by Sergey B Kirpichev.gh-148370:
configparser: prevent quadratic behavior when aParsingErroris raised after a parser fails to parse multiple lines. Patch by Bénédikt Tran.gh-121190:
importlib.resources.files()now emits a more meaningful error message when module spec is None (as found in some__main__modules).gh-127012:
importlib.abc.Traversable.read_textnow allows/solicits anerrorsparameter.gh-137855: Improve import time of
dataclassesmodule by lazy importingreandcopymodules.gh-148352: Add more color to
calendar’s CLI output. Patch by Hugo van Kemenade.gh-148254: Use singular “sec” instead of “secs” in
timeitverbose output for consistency with other time units.gh-130472: Integrate fancycompleter with import completions.
gh-148241:
json: Fix serialization: no longer callstr(obj)onstrsubclasses. Patch by Victor Stinner.gh-148225: The
profiling.samplingreplaycommand now rejects non-binary profile files with a clear error explaining that replay only accepts files created with--binary.gh-148192:
email.generator.Generator._make_boundarycould fail to detect a duplicate boundary string if linesep was not n. It now correctly detects boundary strings when linesep is rn as well.gh-148207:
typing.TypeVarTuplenow acceptsbound,covariant,contravariant, andinfer_varianceparameters, matching the interface oftyping.TypeVarandtyping.ParamSpec.gh-148100: Soft deprecate
re.match()andre.Pattern.match()in favour ofre.prefixmatch()andre.Pattern.prefixmatch(). Patch by Hugo van Kemenade.gh-147991: Improve
tomllibimport 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.samplingmodule 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
timeitCLI output. Patch by Hugo van Kemenade.gh-146563:
xml.parsers.expat: add an exception note when a custom Expat handler return value cannot be properly interpreted. Patch by Bénédikt Tran.gh-137586: Add
MacOStowebbrowserfor macOS, which opens URLs via/usr/bin/openinstead of piping AppleScript toosascript. DeprecateMacOSXOSAScriptin favour ofMacOS.gh-146406: Cross-language method suggestions are now shown for
AttributeErroron builtin types and their subclasses. For example,[].push()suggestsappend,(1,2).append(3)suggests using alist,None.keys()suggests expecting adict, and1.0.__or__suggests using anint.gh-146313: Fix a deadlock in
multiprocessing’s resource tracker where the parent process could hang indefinitely inos.waitpid()during interpreter shutdown if a child created viaos.fork()still held the resource tracker’s pipe open.gh-146292: Add colour to
BaseHTTPRequestHandlerlogs, as used by thehttp.serverCLI. Patch by Hugo van Kemenade.gh-145917: Add MIME types for TTC and Haptics formats to
mimetypes. (Contributed by Charlie Lin in gh-145918.)gh-145846: Fix memory leak in
_lsprofwhenclear()is called during active profiling with nested calls.clearEntries()now walks the entirecurrentProfilerContextlinked list instead of only freeing the top context.gh-145831: Fix
email.quoprimime.decode()leaving a stray\rwheneol='\r\n'by stripping the full eol string instead of one character.gh-145244: Fixed a use-after-free in
jsonencoder when adefaultcallback mutates the dictionary being serialized.gh-117716: Fix
wavewriting of odd-sizeddatachunks by appending the required RIFF pad byte and correcting the RIFF chunk size field accordingly.gh-145200:
hashlib: fix a memory leak when allocating or initializing an OpenSSL HMAC context fails.gh-145056: Add support for
frozendictindataclasses.asdict()anddataclasses.astuple().gh-145105: Fix crash in
csvreader when iterating with a re-entrant iterator that callsnext()on the same reader from within__next__.gh-130750: Restore quoting of choices in
argparseerror messages for improved clarity and consistency with documentation.gh-137855: Reduce the import time of
dataclassesmodule by ~20%.gh-70647:
strptime()now raisesValueErrorwhen the format string contains%dwithout a year directive. Using%ewithout a year now emits aDeprecationWarning.gh-105936: Attempting to mutate non-field attributes of
dataclasseswith both frozen and slots beingTruenow raisesFrozenInstanceErrorinstead ofTypeError. Their non-dataclass subclasses can now freely mutate non-field attributes, and the original non-slotted class can be garbage collected.gh-142831: Fix a crash in the
jsonmodule where a use-after-free could occur if the object being encoded is modified during serialization.gh-108411:
typing.IOandtyping.BinaryIOmethod arguments are now positional-only.gh-130273: Fix traceback color output with Unicode characters.
gh-142307:
imaplib: deprecate support forIMAP4.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
asyncioREPL now handles exceptions when executingPYTHONSTARTUPscripts. 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
mtimeargument totarfile.open(), for setting themtimeheader field in.tar.gzarchives.gh-125862: The
contextlib.contextmanager()andcontextlib.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
-Hor--headerCLI 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
@dataclasswouldn’t detectClassVarfields ifClassVarwas re-exported from a module other thantyping.gh-132631: Fix “I/O operation on closed file” when parsing JSON Lines file with
JSON CLI.gh-108951:
asyncio: AddTaskGroup.cancelwhich cancels unfinished tasks and exits the group without raisingasyncio.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
emailmodule no longer incorrectly uses RFC 2047 encoding for a mailbox with non-ASCII characters in its local-part. Under a policy withutf8setFalse, attempting to serialize such a message will now raise anHeaderWriteError. There is no valid 7-bit encoding for an internationalized local-part. Useemail.policy.SMTPUTF8(or another policy withutf8=True) to correctly pass through the local-part as Unicode characters.gh-83938: The
emailmodule no longer incorrectly uses RFC 2047 encoding for a mailbox with non-ASCII characters in its domain. Under a policy withutf8setFalse, attempting to serialize such a message will now raise anHeaderWriteError. Either apply an appropriate IDNA encoding to convert the domain to ASCII before serialization, or useemail.policy.SMTPUTF8(or another policy withutf8=True) to correctly pass through the internationalized domain name as Unicode characters.gh-81074: The
emailmodule no longer treats email addresses with non-ASCII characters as defects when parsing a Unicode string or in theaddr_specparameter toemail.headerregistry.Address. RFC 5322 permits such addresses, and they were already supported when parsing bytes and in the Addressusernameparameter.The (undocumented)
email.errors.NonASCIILocalPartDefectis no longer used and should be considered deprecated.gh-70039: Fixed bug where
smtplib.SMTP.starttls()could fail ifsmtplib.SMTP.connect()is called explicitly rather than implicitly.gh-113471: Allow
http.serverto 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 casesgh-96894: Do not turn echo off for subsequent commands in batch activators (
activate.batanddeactivate.bat) ofvenv.
Documentation¶
gh-148663: Document that
calendar.IllegalMonthErroris a subclass of bothValueErrorandIndexErrorsince Python 3.12.gh-146646: Document that
glob.glob(),glob.iglob(),pathlib.Path.glob(), andpathlib.Path.rglob()silently suppressOSErrorexceptions raised from scanning the filesystem.
Tests¶
Build¶
gh-149353: Avoid unnecessary JIT-related rebuilds during
make installafter--enable-optimizationsbuilds.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.exerather thanPCbuild/amd64/python3.15t.exe. ThePC/layoutscript 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=atomicflag on i686. The flag has been added to fix a random GCC internal error on PGO build (gh-145801) caused by corruption of profile data (.gcda files). The problem is that it makes the PGO build way slower (up to 47x slower) on i686. Since the GCC internal error was not seen on i686 so far, don’t use-fprofile-update=atomicon i686 anymore. Patch by Victor Stinner.gh-148483: Use
Py_GCC_ATTRIBUTE(unused)for stop_tracing label.gh-148474: Fixed compilation of
Python/pystrhex.cwith older clang versions.gh-146445: The Android build tools have been moved to the Platforms folder.
gh-146264: Fix static module builds on non-WASI targets by linking HACL dependencies as static libraries when
MODULE_BUILDTYPE=static, preventing duplicate_Py_LibHacl_*symbol errors at link time.gh-138451: Allow for custom LLVM path using
LLVM_TOOLS_INSTALL_DIRduring JIT build.gh-133312: Add a new
./configureoption--enable-static-libpython-for-interpreterwhich, when used with--enable-shared, continues to build the shared library but does not use it for the interpreter. Instead, libpython is statically linked into the interpreter, as if--enable-sharedhad not been used. This allows you to do a single build and get a Python interpreter binary that does not use a shared library but also get a shared library for use by other programs.
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¶
IDLE¶
gh-94523: Detect file if modified at local disk and prompt to ask refresh. Patch by Shixian Li.
gh-139551: Support rendering
BaseExceptionGroupin IDLE.gh-89520: Make IDLE extension configuration look at user config files, allowing user-installed extensions to have settings and key bindings defined in ~/.idlerc.
C API¶
gh-149225:
PyCriticalSectionand related functions are added to the Stable ABI.gh-149216:
PyType_WatchCallbackcallbacks registered viaPyType_AddWatcher()are now also invoked when a watched heap type is deallocated. Previously, type watchers were only notified of modifications, which could cause stale references when a type was freed and its address was reused.gh-149044: Implement PEP 820: Unified slot system for the C API.
gh-148267: Using
Py_LIMITED_APIon a non-Windows free-threaded build no longer needs an extraPy_GIL_DISABLED.gh-145559: Rename
_Py_DumpTracebackand_Py_DumpTracebackThreadstoPyUnstable_DumpTraceback()andPyUnstable_DumpTracebackThreads().gh-146636: Implement PEP 803 –
abi3t: Stable ABI for Free-Threaded Builds.gh-146302:
Py_IsInitialized()no longer returns true until initialization has fully completed, including import of thesitemodule. The underlying runtime flags now use atomic operations.gh-146063: Add
PyObject_CallFinalizerFromDealloc()function to the limited C API. Patch by Victor Stinner.gh-145921: Add functions that are guaranteed to be safe for use in
tp_traversehandlers:PyObject_GetTypeData_DuringGC(),PyObject_GetItemData_DuringGC(),PyType_GetModuleState_DuringGC(),PyModule_GetState_DuringGC(),PyModule_GetToken_DuringGC(),PyType_GetBaseByToken_DuringGC(),PyType_GetModule_DuringGC(),PyType_GetModuleByToken_DuringGC().
Python 3.15.0 alpha 8¶
Release date: 2026-04-07
Security¶
gh-145986:
xml.parsers.expat: Fixed a crash caused by unbounded C recursion when converting deeply nested XML content models withElementDeclHandler(). This addresses CVE 2026-4224.gh-145599: Reject control characters in
http.cookies.Morselupdate()andjs_output(). This addresses CVE 2026-3644.gh-143930: Reject leading dashes in URLs passed to
webbrowser.open().
Core and Builtins¶
gh-148157: Fix an unlikely crash when parsing an invalid type comments for function parameters. Found by OSS Fuzz in #492782951.
gh-100239: Propagate result type and uniqueness information through
_BINARY_OP_EXTENDin the tier 2 optimizer, enabling elimination of downstream type guards and selection of inplace float operations.gh-148144: Initialize
_PyInterpreterFrame.visitedwhen copying interpreter frames so incremental GC does not read an uninitialized byte from generator and frame-object copies.gh-148072: Cache
pickle.dumpsandpickle.loadsper interpreter in the XIData framework, avoiding repeated module lookups on every cross-interpreter data transfer. This speeds upInterpreterPoolExecutorfor mutable types (list,dict) by 1.7x–3.3x.gh-148110: Fix
sys.set_lazy_imports_filter()so relative lazy imports pass the resolved imported module name to the filter callback. Patch by Pablo Galindo.gh-148083: Constant-fold
_CONTAINS_OP_SETforfrozenset. Patch by Donghee Na.gh-144319: Fix a bug that could cause applications with specific allocation patterns to leak memory via Huge Pages if compiled with Huge Page support. Patch by Pablo Galindo
gh-147985: Make
PySet_Contains()attempt a lock-free lookup, similar toset.__contains__(). This avoids acquiring the set object mutex in the normal case.gh-147856: Allow the count argument of
bytes.replace()to be a keyword.gh-146615: Fix a crash in
__get__()for METH_METHOD descriptors when an invalid (non-type) object is passed as the second argument. Patch by Steven Sun.gh-146306: Optimize compact integer arithmetic in the JIT by mutating uniquely-referenced operands in place, avoiding allocation of a new int object. Speeds up the pyperformance
spectral_normbenchmark by ~10%.gh-146587: Fix type slot assignment incase of multiple slots for same name in type object implementation. Patch by Kumar Aditya.
gh-126910: Set frame pointers in
aarch64-unknown-linux-gnuJIT code, allowing most native profilers and debuggers to unwind through them. Patch by Diego Russogh-146388: Adds a null check to handle when the JIT optimizer runs out of space when dealing with contradictions in
make_bottom.gh-146308: Fixed multiple error handling issues in the
_remote_debuggingmodule including a double-free in code object caching, memory leaks on allocation failure, missing exception checks in binary format varint decoding, reference leaks on error paths in frame chain processing, and inconsistent thread status error reporting across platforms. Patch by Pablo Galindo.gh-146306: Optimize float arithmetic in the JIT by mutating uniquely-referenced operands in place, avoiding allocation of a new float object. Speeds up the pyperformance
nbodybenchmark by ~19%.gh-146128: Fix a bug which could cause constant values to be partially corrupted in AArch64 JIT code. This issue is theoretical, and hasn’t actually been observed in unmodified Python interpreters.
gh-146250: Fixed a memory leak in
SyntaxErrorwhen re-initializing it.gh-146245: Fixed reference leaks in
socketwhen audit hooks raise exceptions insocket.getaddrinfo()andsocket.sendto().gh-146151:
memoryviewnow supports the float complex and double complex C types: formatting characters'F'and'D'respectively. Patch by Sergey B Kirpichev.gh-146196: Fix potential Undefined Behavior in
PyUnicodeWriter_WriteASCII()by adding a zero-length check. Patch by Shamil Abdulaev.gh-146227: Fix wrong type in
_Py_atomic_load_uint16in the C11 atomics backend (pyatomic_std.h), which used a 32-bit atomic load instead of 16-bit. Found by Mohammed Zuhaib.gh-146205: Fixed a bug where
select.epoll.close(),select.kqueue.close(), andselect.devpoll.close()silently ignored errors.gh-146199: Comparison of code objects now handles errors correctly.
gh-145667: Remove the
GET_ITER_YIELD_FROMinstruction, modifyingSENDto pair withGET_ITERwhen compilingyield fromexpressions.gh-146192: Add Base32 support to
binasciiand improve the performance of the Base32 converters inbase64. Patch by James Seo.gh-135871: Improve multithreaded scaling of PyMutex in low-contention scenarios by reloading the lock’s internal state, without slowing down high-contention scenarios.
gh-146096: Fixed segmentation fault when called repr for BaseExceptionGroup with empty or 1-size tuple args.
gh-146056: Fix
repr()for lists and tuples containingNULLs.gh-145059: Fixed
sys.lazy_modulesto include lazy modules without submodules. Patch by Bartosz Sławecki.gh-146041: Fix free-threading scaling bottleneck in
sys.intern()andPyObject_SetAttr()by avoiding the interpreter-wide lock when the string is already interned and immortalized.gh-145990:
python --help-envsections are now sorted by environment variable name.gh-145990:
python --help-xoptionsis now sorted by-Xoption name.gh-145876:
AttributeErrors andKeyErrors raised inkeys()or__getitem__()during dictionary unpacking ({**mymapping}orfunc(**mymapping)) are no longer masked byTypeError.gh-127958: Support tracing from function entrypoints in the JIT. Patch by Ken Jin.
gh-145376: Fix GC tracking in
structseq.__replace__().gh-145792: Fix out-of-bounds access when invoking faulthandler on a CPython build compiled without support for VLAs.
gh-142183: Avoid a pathological case where repeated calls at a specific stack depth could be significantly slower.
gh-145779: Improve scaling of
classmethod()andstaticmethod()calls in the free-threaded build by avoiding the descriptor__get__call.gh-145783: Fix an unlikely crash in the parser when certain errors were erroneously not propagated. Found by OSS Fuzz in #491369109.
gh-145685: Improve scaling of type attribute lookups in the free-threaded build by avoiding contention on the internal type lock.
gh-145713: Make
bytearray.resize()thread-safe in the free-threaded build by using a critical section and calling the lock-held variant of the resize function.gh-145036: In free-threaded build, fix race condition when calling
__sizeof__()on alistgh-134584: Eliminate redundant refcounting for
MATCH_CLASSin the JIT.gh-69605: Add
math.integerto REPL auto-completion of imports.gh-131798: Optimize
_ITER_CHECK_RANGEand_ITER_CHECK_LISTin the JITgh-143414: Add tracking to the JIT optimizer to determine whether a reference is uniquely owned or shared
gh-143636: Fix a crash when calling
SimpleNamespace.__replace__()on non-namespace instances. Patch by Bénédikt Tran.gh-126910: Set frame pointers in
x86_64-unknown-linux-gnuJIT code, allowing most native profilers and debuggers to unwind through them.gh-140594: Fix an out of bounds read when a single NUL character is read from the standard input. Patch by Shamil Abdulaev.
gh-140870: Add support for module attributes in the REPL auto-completion of imports.
Library¶
gh-144503: Fix a regression introduced in 3.14.3 and 3.13.12 where the
multiprocessingforkserverstart method would fail withBrokenPipeErrorwhen the parent process had a very largesys.argv. The argv is now passed to the forkserver as separate command-line arguments rather than being embedded in the-ccommand string, avoiding the operating system’s per-argument length limit.gh-148153:
base64.b32encode()now always raisesValueErrorinstead ofAssertionErrorfor the value of map01 with invalid length.gh-73613: Add the padded parameter in functions related to Base32 and Base64 codecs in the
binasciiandbase64modules. In the encoding functions it controls whether the pad character can be added in the output, in the decoding functions it controls whether padding is required in input. Padding of input no longer required inbase64.urlsafe_b64decode()by default.gh-146613:
itertools: Fix a crash initertools.groupby()when the grouper iterator is concurrently mutated.gh-147944: Accepted range for the bytes_per_sep argument of
bytes.hex(),bytearray.hex(),memoryview.hex(), andbinascii.b2a_hex()is now increased, so passingsys.maxsizeand-sys.maxsizeis now valid.gh-146080:
ssl: fix a crash when an SNI callback tries to use an SSL object that has already been garbage-collected. Patch by Bénédikt Tran.gh-146556: Fix
annotationlib.get_annotations()hanging indefinitely when called witheval_str=Trueon a callable that has a circular__wrapped__chain (e.g.f.__wrapped__ = f). Cycle detection using an id-based visited set now stops the traversal and falls back to the globals found so far, mirroring the approach ofinspect.unwrap().gh-146090:
sqlite3: fix a crash whensqlite3.Connection.create_collation()fails with SQLITE_BUSY. Patch by Bénédikt Tran.gh-146090:
sqlite3: properly raiseMemoryErrorinstead ofSystemErrorwhen a context callback fails to be allocated. Patch by Bénédikt Tran.gh-146507: Make
asyncio.SelectorEventLoop()stream transport’sget_write_buffer_size()O(1) by maintaining a running byte counter instead of iterating the buffer on every call.gh-145056: Fix merging of
collections.OrderedDictandfrozendict.gh-145056: Add support for merging
collections.UserDictandfrozendict.gh-145633: Fix
struct.pack('f', float): usePyFloat_Pack4()to raiseOverflowError. Patch by Sergey B Kirpichev and Victor Stinner.gh-146440:
json: Add the array_hook parameter toload()andloads()functions: allow a callback for JSON literal array types to customize Python lists in the resulting decoded object. Passing combinedfrozendictto object_pairs_hook param andtupletoarray_hookwill yield a deeply nested immutable Python structure representing the JSON data.gh-146431: Add the wrapcol parameter to
base64functionsb16encode(),b32encode(),b32hexencode(),b85encode()andz85encode(), andbinasciifunctionsb2a_base32()andb2a_base85(). Add the ignorechars parameter tobase64functionsb16decode(),b32decode(),b32hexdecode(),b85decode()andz85decode(), andbinasciifunctionsa2b_hex(),unhexlify(),a2b_base32()anda2b_base85().gh-146310: The
ensurepipmodule no longer looks forpip-*.whlwheel packages in the current directory.gh-141510: Support
frozendictinplistlib, for serialization only. Patch by Hugo van Kemenade.gh-146238: Support half-floats (type code
'e'of thestructmodule) in thearraymodule. Patch by Sergey B Kirpichev.gh-140947: Fix incorrect contextvars handling in server tasks created by
asyncio. Patch by Kumar Aditya.gh-146151: Support the float complex and double complex C types in the
arraymodule: formatting characters'F'and'D'respectively. Patch by Sergey B Kirpichev.gh-143387: In importlib.metadata, when a distribution file is corrupt and there is no metadata file, calls to
Distribution.metadata()(including implicit calls from other properties like.nameand.requires) will now raise aMetadataNotFoundException. This allows callers to distinguish between missing metadata and a degenerate (empty) metadata. Previously, if the file was missing, an emptyPackageMetadatawould be returned and would be indistinguishable from the presence of an empty file.gh-146228: Cached FastPath objects in importlib.metadata are now cleared on fork, avoiding broken references to zip files during fork.
gh-146171: Nested
AttributeErrorsuggestions now include property-backed attributes on nested objects without executing the property getter.gh-145410: On Windows,
sysconfig.get_platform()now gets the platform from the_sysconfigmodule instead of parsingsys.versionstring. Patch by Victor Stinner.gh-146091: Fix a bug in
termios.tcsetwinsize()where passing a sequence that raises an exception in__getitem__would cause aSystemErrorinstead of propagating the original exception.gh-146076:
zoneinfo: fix crashes when deleting_weak_cachefrom azoneinfo.ZoneInfosubclass.gh-123471: Make concurrent iteration over
itertools.zip_longestsafe under free-threading.gh-146075: Errors when calling
functools.partial()with a malformed keyword will no longer crash the interpreter.gh-146054: Limit the size of
encodings.search_function()cache. Found by OSS Fuzz in #493449985.gh-146004: All
-Xoptions from the Python command line are now propagated to child processes spawned bymultiprocessing, not just a hard-coded subset. This makes the behavior consistent between default “spawn” and “forkserver” start methods and the old “fork” start method. The options that were previously not propagated are:context_aware_warnings,cpu_count,disable-remote-debug,int_max_str_digits,lazy_imports,no_debug_ranges,pathconfig_warnings,perf,perf_jit,presite,pycache_prefix,thread_inherit_context, andwarn_default_encoding.gh-145980: Added the alphabet parameter in
b2a_base64(),a2b_base64(),b2a_base85()anda2b_base85()and a number of*_ALPHABETconstants in thebinasciimodule. Removedb2a_z85()anda2b_z85().gh-145968: Fix translation in
base64.b64decode()when altchars overlaps with the standard ones.gh-145966: Non-
AttributeErrorexceptions raised during dialect attribute lookup incsvare no longer silently suppressed.gh-145883:
zoneinfo: Fix heap buffer overflow reads from malformed TZif data. Found by OSS Fuzz, issues #492245058 and #492230068.gh-145850: Changed some implementation details in
struct.Struct: calling it with non-ASCII string format will now raise aValueErrorinstead ofUnicodeEncodeError, calling it with non-ASCII bytes format will now raise aValueErrorinstead ofstruct.error, getting theformatattribute of uninitialized object will now raise anAttributeErrorinstead ofRuntimeError.gh-123720: asyncio: Fix
asyncio.Server.serve_forever()shutdown regression. Since 3.12, cancellingserve_forever()could hang waiting for a handler blocked on a read from a client that never closed (effectively requiring two interrupts to stop); the shutdown sequence now ensures client streams are closed soserve_forever()exits promptly and handlers observe EOF.gh-138122: The
profiling.samplingmodule now supports differential flamegraph visualization via--diff-flamegraphto compare two profiling runs. Functions are colored red (regressions), blue (improvements), gray (neutral), or purple (new). Elided stacks show code paths that disappeared between runs.gh-145754: Request signature during mock autospec with
FORWARDREFannotation format. This prevents runtime errors when an annotation uses a name that is not defined at runtime.gh-145750: Avoid undefined behaviour from signed integer overflow when parsing format strings in the
structmodule. Found by OSS Fuzz in #488466741.gh-145717: Add a few Microsoft-specific MIME types.
gh-145703:
asyncio: Make sure thatloop.call_atandloop.call_latertrigger scheduled events on time when the clock resolution becomes too small.gh-145697: Add
application/sqlandapplication/vnd.sqlite3intomimetypes.gh-145492: Fix infinite recursion in
collections.defaultdict__repr__when adefaultdictcontains itself. Based on analysis by KowalskiThomas in gh-145492.gh-145650: Add
__repr__()support tologging.Formatterandlogging.Filter, showing the format string and filter name respectively.gh-145587: Resolved a performance regression in
multiprocessing.connection.waiton Windows that caused infinite busy loops when called with no objects. The function now properly yields control to the OS to conserve CPU resources. Patch By Shrey Naithanigh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel
gh-145546: Fix
unittest.util.sorted_list_difference()to deduplicate remaining elements when one input list is exhausted before the other.gh-145446: Now
functoolsis safer in free-threaded build when using keywords infunctools.partial()gh-145264: Base64 decoder (see
binascii.a2b_base64(),base64.b64decode(), etc) no longer ignores excess data after the first padded quad in non-strict (default) mode. Instead, in conformance with RFC 4648, section 3.3, it now ignores the pad character, “=”, if it is present before the end of the encoded data.gh-145035: Allows omitting the internal library
_pyreplwith limited loss of functionality. This allows complete removal of the modern REPL, which is an unsupported configuration, but still desirable for some distributions.gh-144270: Made the tag parameter of
xml.etree.ElementTree.Elementand the parent and tag parameters ofxml.etree.ElementTree.SubElement()positional-only, matching the behavior of the C accelerator.gh-144984: Fix crash in
xml.parsers.expat.xmlparser.ExternalEntityParserCreate()when an allocation fails. The error paths could dereference NULLhandlersand double-decrement the parent parser’s reference count.gh-144975:
wave.Wave_write.setframerate()now validates the frame rate after rounding to an integer, preventing values like0.5from being accepted and causing confusing errors later. Patch by Michiel Beijen.gh-140715: Add
%nand%tsupport tostrptime().gh-144259: Fix inconsistent display of long multiline pasted content in the REPL.
gh-140814:
multiprocessing.freeze_support()no longer sets the default start method as a side effect, which previously caused a subsequentmultiprocessing.set_start_method()call to raiseRuntimeError.gh-123471: Make concurrent iteration over
itertools.accumulatesafe under free-threading.gh-143715: Calling the
Struct.__new__()without required argument now is deprecated. Calling__init__()method on initializedStructobjects is deprecated.gh-142763: Fix a race condition between
zoneinfo.ZoneInfocreation andzoneinfo.ZoneInfo.clear_cache()that could raiseKeyError.gh-141707: Don’t change
tarfile.TarInfotype fromAREGTYPEtoDIRTYPEwhen parsing GNU long name or link headers.gh-138577:
getpass.getpass()with non-emptyecho_charnow handles keyboard shortcuts including Ctrl+A/E (cursor movement), Ctrl+K/U (kill line), Ctrl+W (erase word), and Ctrl+V (literal next) by reading the terminal’s control character settings and processing them appropriately in non-canonical mode. Patch by Sanyam Khurana.gh-140049:
traceback.format_exception_only()now colorizes exception notes.gh-139933: Improve
AttributeErrorsuggestions for classes with a custom__dir__()method returning a list of unsortable values. Patch by Bénédikt Tran.gh-139633: The
netrcsecurity check is now run once per parse rather than once per entry.gh-130472: Add fancycompleter and enable it by default when using pyrepl. This gives colored tab completion.
gh-112632: Add an expand keyword argument for
pprint.pprint(),pprint.pformat(),pprint.pp()by passing on all kwargs andpprint.PrettyPrinter. Contributed by Stefan Todoran and Semyon Moroz.gh-66419: Optional argument with nargs equals to
argparse.REMAINDERnow consumes all remaining arguments including'--'.gh-60729: Add support for floating point audio wave files in
wave.bpo-36461: Make the target time of
timeit.Timer.autorange()configurable and add--target-timeoption to the command-line interface oftimeit.
Documentation¶
Tests¶
gh-144418: The Android testbed’s emulator RAM has been increased from 2 GB to 4 GB.
gh-146202: Fix a race condition in regrtest: make sure that the temporary directory is created in the worker process. Previously, temp_cwd() could fail on Windows if the “build” directory was not created. Patch by Victor Stinner.
Build¶
gh-146541: The Android testbed can now be built for 32-bit ARM and x86 targets.
gh-146498: The iOS XCframework build script now ensures libpython isn’t included in installed app content, and is more robust in identifying standard library binary content that requires processing.
gh-146450: The Android build script was modified to improve parity with other platform build scripts.
gh-146446: The clean target for the Apple/iOS XCframework build script is now more selective when targeting a single architecture.
gh-146444: The Apple/iOS build script has been moved to the Platforms directory.
gh-146210: Fix building the jit stencils on Windows when the interpreter is built with a different clang version. Patch by Chris Eibl.
gh-145844: Update to WASI SDK 32.
gh-145801: When Python build is optimized with GCC using PGO, use
-fprofile-update=atomicoption to use atomic operations when updating profile information. This option reduces the risk of gcov Data Files (.gcda) corruption which can cause random GCC crashes. Patch by Victor Stinner.gh-138850: Add
--disable-epolltoconfiguregh-145633: Remove support for ancient ARM platforms (ARMv4L and ARMv5L OABI boards), using mixed-endian representation for doubles. Patch by Sergey B Kirpichev.
gh-85277: Fix building without
stropts.hor emptystropts.h
Windows¶
gh-140131: Fix REPL cursor position on Windows when module completion suggestion line hits console width.
macOS¶
gh-137586: Invoke osascript with absolute path in
webbrowserandturtledemo.
Tools/Demos¶
gh-135953: Properly identify the main thread in the Gecko profiler collector by using a status flag from the interpreter state instead of relying on
threading.main_thread()in the collector process.gh-145976: Remove
Misc/indent.pro, a configuration file for GNU indent(1).gh-145976: Remove
Misc/vgrindefsandMisc/Porting.
C API¶
gh-146636: The
Py_mod_abislot is now mandatory for modules created from a slots array (usingPyModule_FromSlotsAndSpec()or thePyModExport_*export hook).gh-146175: The following macros are soft deprecated:
Py_ALIGNED,PY_FORMAT_SIZE_T,Py_LL,Py_ULL,PY_LONG_LONG,PY_LLONG_MIN,PY_LLONG_MAX,PY_ULLONG_MAX,PY_INT32_T,PY_UINT32_T,PY_INT64_T,PY_UINT64_T,PY_SIZE_MAX,Py_UNICODE_SIZE,Py_VA_COPY.The macro
Py_UNICODE_WIDE, which was scheduled for removal, is soft deprecated instead.gh-146143:
PyUnicodeWriter_WriteUCS4()now accepts a pointer to a constant buffer ofPy_UCS4.gh-146056:
PyUnicodeWriter_WriteRepr()now supportsNULLargument.gh-145010: Use GCC dialect alternatives for inline assembly in
object.hso that the Python headers compile correctly with-masm=intel.
Python 3.15.0 alpha 7¶
Release date: 2026-03-10
Windows¶
gh-145731: Fix negative timestamp during DST on Windows. Patch by Hugo van Kemenade.
gh-145307: Defers loading of the
psapi.dllmodule until it is used byctypes.util.dllist().gh-144551: Updated bundled version of OpenSSL to 3.5.5.
Tests¶
gh-144741: Fix
test_frame_pointer_unwindwhen Python is built with--enable-shared. Classify also libpython frames as"python". Patch by Victor Stinner.gh-144739: When Python was compiled with system expat older then 2.7.2 but tests run with newer expat, still skip
test.test_pyexpat.MemoryProtectionTest.
Security¶
gh-145506: Fixes CVE 2026-2297 by ensuring that
SourcelessFileLoaderusesio.open_code()when opening.pycfiles.gh-144370: Disallow usage of control characters in status in
wsgiref.handlersto prevent HTTP header injections. Patch by Benedikt Johannes.
Library¶
gh-145623: Fix crash in
structwhen callingrepr()or__sizeof__()on an uninitializedstruct.Structobject created viaStruct.__new__()without calling__init__().gh-145551: Fix InvalidStateError when cancelling process created by
asyncio.create_subprocess_exec()orasyncio.create_subprocess_shell(). Patch by Daan De Meyer.gh-141510:
marshalnow supportsfrozendictobjects. The marshal format version was increased to 6. Patch by Victor Stinner.gh-145417:
venv: Prevent incorrect preservation of SELinux context when copying theActivate.ps1script. The script inherited the SELinux security context of the system template directory, rather than the destination project directory.gh-145335:
os.listdir(-1)andos.scandir(-1)now fail withOSError(errno.EBADF)rather than listing the current directory.os.listxattr(-1)now fails withOSError(errno.EBADF)rather than listing extended attributes of the current directory. Patch by Victor Stinner.gh-145376: Fix double free and null pointer dereference in unusual error scenarios in
hashlibandhmacmodules.gh-145301:
hmac: fix a crash when the initialization of the underlying C extension module fails.gh-145301:
hashlib: fix a crash when the initialization of the underlying C extension module fails.gh-76007: The
versionattribute of thetarfilemodule is deprecated and slated for removal in Python 3.20.gh-145158: Avoid undefined behaviour from signed integer overflow when parsing format strings in the
structmodule.gh-123853: Removed Windows 95 compatibility for
locale.getdefaultlocale().gh-66802: Add
unicodedata.block()function to return the Unicode block of a character.gh-145033: Add
typing.TypeForm, implementing PEP 747. Patch by Jelle Zijlstra.gh-141510:
dataclasses.field(): if metadata isNone, use an emptyfrozendict, instead of aMappingProxyType()of an emptydict. Patch by Victor Stinner.gh-145006: Add
ModuleNotFoundErrorhints when a module for a different ABI exists.gh-141510:
ParameterizedMIMEHeader.paramsofemail.headerregistryis now afrozendictinstead of atypes.MappingProxyType. Patch by Victor Stinner.gh-134872: Add valid import name suggestions on
ModuleNotFoundError.gh-88091: Fix
unicodedata.decomposition()for Hangul characters.gh-144986: Fix a memory leak in
atexit.register(). Patch by Shamil Abdulaev.gh-144777: Fix data races in
io.IncrementalNewlineDecoderin the free-threaded build.gh-144809: Make
collections.dequecopy atomic in the free-threaded build.gh-141510: The
copymodule now supports thefrozendicttype. Patch by Pieter Eendebak based on work by Victor Stinner.gh-141510: The
jsonmodule now supports thefrozendicttype. Patch by Victor Stinner.gh-144835: Added missing explanations for some parameters in
glob.glob()andglob.iglob().gh-144833: Fixed a use-after-free in
sslwhenSSL_new()returns NULL innewPySSLSocket(). The error was reported via a dangling pointer after the object had already been freed.gh-140715: Add
'%D'support tostrptime().gh-144782: Fix
argparse.ArgumentParserto bepickleable.gh-144763: Fix a race condition in
tracemalloc: it no longer detaches the attached thread state to acquire its internal lock. Patch by Victor Stinner.gh-142224:
unicodedata.bidirectional()now return the correct default bidi class for unassigned code points.gh-117865: Reduce the import time of
inspectmodule by ~20%.gh-144156: Fix the folding of headers by the
emaillibrary when RFC 2047 encoded words are used. Now whitespace is correctly preserved and also correctly added between adjacent encoded words. The latter property was broken by the fix for gh-92081, which mostly fixed previous failures to preserve whitespace.gh-66305: Fixed a hang on Windows in the
tempfilemodule when trying to create a temporary file or subdirectory in a non-writable directory.gh-144615: Methods directly decorated with
@functools.singledispatchmethodnow dispatch on the second argument when called after being accessed as class attributes. Patch by Bartosz Sławecki.gh-144321: The functional syntax for creating
typing.NamedTupleclasses now supports passing any iterable of fields and types. Previously, only sequences were supported.gh-144475: Calling
repr()onfunctools.partial()is now safer when the partial object’s internal attributes are replaced while the string representation is being generated.gh-144285: Attribute suggestions in
AttributeErrortracebacks are now formatted differently to make them easier to understand, for example:Did you mean '.datetime.now' instead of '.now'. Contributed by Bartosz Sławecki.gh-144316: Fix crash in
_remote_debuggingthat causedtest_external_inspectionto intermittently fail. Patch by Taegyun Kim.gh-143637: Fixed a crash in socket.sendmsg() that could occur if ancillary data is mutated re-entrantly during argument parsing.
gh-140652: Fix a crash in
_interpchannels.list_all()after closing a channel.gh-143698: Allow scheduler and setpgroup arguments to be explicitly
Nonewhen callingos.posix_spawn()oros.posix_spawnp(). Patch by Bénédikt Tran.gh-143698: Raise
TypeErrorinstead ofSystemErrorwhen the scheduler inos.posix_spawn()oros.posix_spawnp()is not a tuple. Patch by Bénédikt Tran.gh-142516:
ssl: fix reference leaks inssl.SSLContextobjects. Patch by Bénédikt Tran.gh-85809: Added path-like object support for
shutil.make_archive().gh-143304: Fix
ctypes.CDLLto honor thehandleparameter on POSIX systems.gh-142781:
zoneinfo: fix a crash when instantiatingZoneInfoobjects for which the internal class-level cache is inconsistent.gh-142787: Fix assertion failure in
sqlite3blob subscript when slicing with indices that result in an empty slice.gh-142352: Fix
asyncio.StreamWriter.start_tls()to transfer buffered data fromStreamReaderto the SSL layer, preventing data loss when upgrading a connection to TLS mid-stream (e.g., when implementing PROXY protocol support).gh-139899: Introduced
importlib.abc.MetaPathFinder.discover()andimportlib.abc.PathEntryFinder.discover()to allow module and submodule name discovery without assuming the use of traditional filesystem based imports.gh-137335: Get rid of any possibility of a name conflict for named pipes in
multiprocessingandasyncioon Windows, no matter how small.gh-135883: Fix
sqlite3’s interactive shell keeping part of previous commands when scrolling history.gh-124748: Improve
TypeErrorerror message whenweakref.WeakKeyDictionary.update()is used with keyword-only parameters.gh-80667: Add support for Tangut Ideographs names in
unicodedata.bpo-42353: The
remodule gains a newre.prefixmatch()function as an explicit spelling of what has to date always been known asre.match().re.Patternsimilary gains are.Pattern.prefixmatch()method.Why? Explicit is better than implicit. Other widely used languages all use the term “match” to mean what Python uses the term “search” for. The unadorened “match” name in Python has been a frequent case of confusion and coding bugs due to the inconsistency with the rest if the software industry.
We do not plan to deprecate and remove the older
matchname.bpo-40243: Fix
unicodedata.ucd_3_2_0.numeric()for non-decimal values.bpo-40212: Re-enable
os.posix_fallocate()andos.posix_fadvise()on AIX.bpo-3405: Add support for user data of Tk virtual events and detail for
Enter,Leave,FocusIn,FocusOut, andConfigureRequestevents totkinter.bpo-32234:
mailbox.Mailboxinstances can now be used as a context manager. The Mailbox is locked on context entry and unlocked and closed at context exit.
Documentation¶
gh-145450: Document missing public
wave.Wave_writegetter methods.gh-110937: Document rest of full public
importlib.metadata.DistributionAPI. Also add the (already documented)PackagePathto__all__.gh-136246: A new “Improve this page” link is available in the left-hand sidebar of the docs, offering links to create GitHub issues, discussion forum posts, or pull requests.
Core and Builtins¶
gh-145701: Fix
SystemErrorwhen__classdict__or__conditional_annotations__is in a class-scope inlined comprehension. Found by OSS Fuzz in #491105000.gh-145615: Fixed a memory leak in the free-threaded build where mimalloc pages could become permanently unreclaimable until the owning thread exited.
gh-116738: Make
mmap.mmap.set_name()thread-safe on the free threaded build.gh-145566: In the free threading build, skip the stop-the-world pause when reassigning
__class__on a newly created object.gh-143055: Fix crash in AST unparser when unparsing dict comprehension unpacking. Found by OSS Fuzz in #489790200.
gh-145335: Fix a crash in
os.pathconf()when called with-1as the path argument.gh-145376: Fix reference leaks in various unusual error scenarios.
gh-145234: Fixed a
SystemErrorin the parser when an encoding cookie (for example, UTF-7) decodes to carriage returns (\r). Newlines are now normalized after decoding in the string tokenizer.Patch by Pablo Galindo.
gh-145275: Added the
-X pathconfig_warningsandPYTHON_PATHCONFIG_WARNINGSoptions, allowing to disable warnings from The initialization of the sys.path module search path.gh-145273: A warning is now shown during The initialization of the sys.path module search path if it can’t find a valid standard library.
gh-145241: Specialized the parser error for when
withitems are followed by a trailing comma (for example,with item,:), raising a clearerSyntaxErrormessage. Patch by Pablo Galindo and Bartosz Sławecki.gh-130555: Fix use-after-free in
dict.clear()when the dictionary values are embedded in an object and a destructor causes re-entrant mutation of the dictionary.gh-145197: Fix JIT trace crash when recording function from cleared generator frame.
gh-145187: Fix compiler assertion fail when a type parameter bound contains an invalid expression in a conditional block.
gh-145142: Fix a crash in the free-threaded build when the dictionary argument to
str.maketrans()is concurrently modified.gh-145118:
str.maketrans()now acceptsfrozendict.gh-144015: Speed up
bytes.hex(),bytearray.hex(),binascii.hexlify(), andhashlib.hexdigest()operations with SIMD on x86-64, ARM64, and ARM32 with NEON when built with gcc (version 12 or higher) or clang (version 3 or higher) compilers. Around 1.1-3x faster for common 16-64 byte inputs such as hashlib hex digests, and up to 8x faster for larger data.gh-145118:
type()now acceptsfrozendictas an argument.gh-145064: Fix JIT optimizer assertion failure during
CALL_ALLOC_AND_ENTER_INITside exit.gh-145055:
exec()andeval()now acceptfrozendictfor globals. Patch by Victor Stinner.gh-145058: Fix a crash when
__lazy_import__()is passed a non-string argument, by raising anTypeErrorinstead.gh-144995: Optimize
memoryviewcomparison: amemoryviewis equal to itself, there is no need to compare values. Patch by Victor Stinner.gh-141510: Update specializer to support frozendict. Patch by Donghee Na.
gh-141510: Optimize
frozendict.fromkeys()to avoid unnecessary thread-safety operations in frozendict cases. Patch by Donghee Na.gh-100239: Speedup
BINARY_OP_EXTENDfor exact floats and medium-size integers by up to 15%. Patch by Chris Eibl.gh-144914: Use
mimallocfor raw memory allocations such as viaPyMem_RawMalloc()for better performance on free-threaded builds. Patch by Kumar Aditya.gh-144872: Fix heap buffer overflow in the parser found by OSS-Fuzz.
gh-144766: Fix a crash in fork child process when perf support is enabled.
gh-144759: Fix undefined behavior in the lexer when
startandmulti_line_startpointers areNULLin_PyLexer_remember_fstring_buffers()and_PyLexer_restore_fstring_buffers(). TheNULLpointer arithmetic (NULL - valid_pointer) is now guarded with explicitNULLchecks.gh-141510: Add built-in
frozendicttype. Patch by Victor Stinner.gh-144681: Fix a JIT assertion failure when a conditional branch jumps to the same target as the fallthrough path.
gh-143300: Add
PyUnstable_SetImmortal()C-API function to mark objects as immortal.gh-144702: Clarify the error message raised when a class pattern is used to match on a non-class object.
gh-144569: Optimize
BINARY_SLICEfor list, tuple, and unicode by avoiding temporarysliceobject creation.gh-144438: Align the QSBR thread state array to a 64-byte cache line boundary to avoid false sharing in the free-threaded build.
gh-142349: Implement PEP 810. Patch by Pablo Galindo and Dino Viehland.
gh-141226: Deprecate PEP 456 support for providing an external definition of the string hashing scheme. Removal is scheduled for Python 3.19. Patch by Bénédikt Tran.
gh-138912: Improve
MATCH_CLASSperformance by up to 52% in certain cases. Patch by Marc Mueller.gh-130327: Fix erroneous clearing of an object’s
__dict__if overwritten at runtime.gh-80667: Literals using the
\N{name}escape syntax can now construct CJK ideographs and Hangul syllables using case-insensitive names.
C API¶
gh-142417: Restore private provisional
_Py_InitializeMain()function removed in Python 3.14. Patch by Victor Stinner.gh-144748:
PyErr_CheckSignals()now raises the exception scheduled byPyThreadState_SetAsyncExc(), if any.gh-144981: Made
PyUnstable_Code_SetExtra(),PyUnstable_Code_GetExtra(), andPyUnstable_Eval_RequestCodeExtraIndex()thread-safe on the free threaded build.gh-141510: Add the following functions for the new
frozendicttype:Patch by Victor Stinner.
gh-121617:
Python.hnow also includes<string.h>in the limited C API version 3.11 and newer to fix thePy_CLEARmacro which usesmemcpy(). Patch by Victor Stinner.gh-144175: Add
PyArg_ParseArray()andPyArg_ParseArrayAndKeywords()functions to parse arguments of functions using theMETH_FASTCALLcalling convention. Patch by Victor Stinner.
Build¶
gh-144533: Use wasmtime’s
--argv0to auto-discover sysconfig in WASI buildsgh-145110: Fix targets “Clean” and “CLeanAll” in case of PGO builds on Windows. Patch by Chris Eibl.
gh-144679: When building with Visual Studio 2026 (Version 18), use PlatformToolSet v145 by default. Patch by Chris Eibl.
gh-144675: Update to WASI SDK 30.
gh-136677: Introduce executable specific linker flags to
./configure.
Python 3.15.0 alpha 6¶
Release date: 2026-02-11
macOS¶
Windows¶
gh-80620: Support negative timestamps in
time.gmtime(),time.localtime(), and variousdatetimefunctions.
Tests¶
gh-144415: The Android testbed now distinguishes between stdout/stderr messages which were triggered by a newline, and those triggered by a manual call to
flush. This fixes logging of progress indicators and similar content.gh-65784: Add support for parametrized resource
wantobjectsin regrtests, which allows to run Tkinter tests with the specified value oftkinter.wantobjects, for example-u wantobjects=0.
Security¶
gh-144125:
BytesGeneratorwill now refuse to serialize (write) headers that are unsafely folded or delimited; seeverify_generated_headers. (Contributed by Bas Bloemsaat and Petr Viktorin in gh-121650).gh-143935: Fixed a bug in the folding of comments when flattening an email message using a modern email policy. Comments consisting of a very long sequence of non-foldable characters could trigger a forced line wrap that omitted the required leading space on the continuation line, causing the remainder of the comment to be interpreted as a new header field. This enabled header injection with carefully crafted inputs.
gh-143925: Reject control characters in
data:URL media types.gh-143923: Reject control characters in POP3 commands.
gh-143921: Reject control characters in IMAP commands.
gh-143919: Reject control characters in
http.cookies.Morselfields and values.gh-143916: Reject C0 control characters within wsgiref.headers.Headers fields, values, and parameters.
Library¶
gh-144538: Bump the version of pip bundled in ensurepip to version 26.0.1
gh-144493: Improve an exception error message in
_overlapped.BindLocal()that is raised whenasyncio.loop.sock_connect()is called on aasyncio.ProactorEventLoopwith a socket that has an invalid address family.gh-144386: Add support for arbitrary descriptors
__enter__(),__exit__(),__aenter__(), and__aexit__()incontextlib.ExitStackandcontextlib.AsyncExitStack, for consistency with thewithandasync withstatements.gh-123471: Make concurrent iteration over
itertools.combinations_with_replacementanditertools.permutationssafe under free-threading.gh-74453: Deprecate
os.path.commonprefix()in favor ofos.path.commonpath()for path segment prefixes.The
os.path.commonprefix()function is being deprecated due to having a misleading name and module. The function is not safe to use for path prefixes despite being included in a module about path manipulation, meaning it is easy to accidentally introduce path traversal vulnerabilities into Python programs by using this function.gh-144380: Improve performance of
io.BufferedReaderline iteration by ~49%.gh-140824: When
faulthandlerdumps the list of third-party extension modules, ignore sub-modules of stdlib packages. Patch by Victor Stinner.gh-144206: Improve error messages for buffer overflow in
fcntl.fcntl()andfcntl.ioctl().gh-144264: Speed up Base64 decoding of data containing ignored characters (both in non-strict mode and with an explicit ignorechars argument). It is now up to 2 times faster for multiline Base64 data.
gh-144249: Add filename context to
OSErrorexceptions raised byssl.SSLContext.load_cert_chain(), allowing users to have more context.gh-132888: Fix incorrect use of
ctypes.GetLastError()and add missing error checks for Windows API calls in_pyrepl.windows_console.gh-144217:
mimetypes: Add support for DICOM files (for medical imaging) with the official MIME typeapplication/dicom. Patch by Benedikt Johannes.gh-144212: Mime type
image/jxlis now supported bymimetypes.gh-143594: Add
symtable.Function.get_cells()andsymtable.Symbol.is_cell()methods.gh-144169: Fix three crashes when non-string keyword arguments are supplied to objects in the
astmodule.gh-144128: Fix a crash in
array.array.fromlist()when an element’s__index__()method mutates the input list during conversion.gh-144100: Fixed a crash in ctypes when using a deprecated
POINTER(str)type inargtypes. Instead of aborting, ctypes now raises a proper Python exception when the pointer target type is unresolved.gh-143658:
importlib.metadata: Usestr.lower()andstr.replace()to further improve performance ofimportlib.metadata.Prepared.normalize(). Patch by Hugo van Kemenade and Henry Schreiner.gh-144050: Fix
stat.filemode()in the pure-Python implementation to avoid misclassifying invalid mode values as block devices.gh-83069:
subprocess.Popen.wait(): whentimeoutis notNone, an efficient event-driven mechanism now waits for process termination, if available. Linux >= 5.3 usesos.pidfd_open()+select.poll(). macOS and other BSD variants useselect.kqueue()+KQ_FILTER_PROC+KQ_NOTE_EXIT. Windows keeps usingWaitForSingleObject(unchanged). If none of these mechanisms are available, the function falls back to the traditional busy loop (non-blocking call and short sleeps). Patch by Giampaolo Rodola.gh-144030: The Python implementation of
functools.lru_cache()differed from the default C implementation in that it did not check that its argument is callable. This discrepancy is now fixed and both raise aTypeError.gh-144001: Added the ignorechars parameter in
binascii.a2b_base64()andbase64.b64decode().gh-144023: Fixed validation of file descriptor 0 in posix functions when used with follow_symlinks parameter.
gh-143999: Fix an issue where
inspect.getgeneratorstate()andinspect.getcoroutinestate()could fail for generators wrapped bytypes.coroutine()in the suspended state.gh-143952: Fixed
asynciodebugging tools to work with new remote debugging API. Patch by Bartosz Sławecki.gh-143904:
struct.pack_into()now raises OverflowError instead of IndexError for too large offset argument.gh-143897: Remove the
isxidstart()andisxidcontinue()methods ofunicodedata.ucd_3_2_0. They are now only exposed asunicodedata.isxidstart()andunicodedata.isxidcontinue().gh-143831:
annotationlib.ForwardRefobjects are now hashable when created from annotation scopes with closures. Previously, hashing such objects would throw an exception. Patch by Bartosz Sławecki.gh-143874: Fixed a bug in
pdbwhere expression results were not sent back to remote client.gh-143754: Add new
tkinterwidget methodspack_content(),place_content()andgrid_content()which are alternative spelling of old*_slaves()methods.gh-143756: Fix potential thread safety issues in
sslmodule.gh-132604: Previously,
Protocolclasses that were not decorated with@~typing.runtime_checkable, but that inherited from anotherProtocolclass that did have this decorator, could be used inisinstance()andissubclass()checks. This behavior is now deprecated and such checks will throw aTypeErrorin Python 3.20. Patch by Bartosz Sławecki.gh-143543: Fix a crash in itertools.groupby that could occur when a user-defined
__eq__()method re-enters the iterator during key comparison.gh-143689: Fix
io.BufferedReader.read1()state cleanup on buffer allocation failure.gh-143602: Fix a inconsistency issue in
write()that leads to unexpected buffer overwrite by deduplicating the buffer exports.gh-142434: Use
ppoll()if available inselect.poll()to have a timeout resolution of 1 nanosecond, instead of a resolution of 1 ms. Patch by Victor Stinner.gh-140557:
array.arraybuffers now have the same alignment when empty as when allocated. Unaligned buffers can still be created by slicing.gh-143423: Fix free-threaded build detection in the sampling profiler when Py_GIL_DISABLED is set to 0.
gh-101178: Add Ascii85, Base85, and Z85 support to
binasciiand improve the performance of the base-85 converters inbase64.gh-142966: Fix
ctypes.POINTER.set_type()not updating the format string to match the type.gh-142555:
array: fix a crash ina[i] = vwhen converting i to an index viai.__index__ori.__float__mutates the array.gh-142438: Fix _decimal builds configured with EXTRA_FUNCTIONALITY by correcting the Context.apply wrapper to pass the right argument.
gh-141860: Add an
on_errorkeyword-only parameter tomultiprocessing.set_forkserver_preload()to control how import failures during module preloading are handled. Accepts'ignore'(default, silent),'warn'(emitImportWarning), or'fail'(raise exception). Contributed by Nick Neumann and Gregory P. Smith.gh-125346: Accepting
+and/characters with an alternative alphabet inbase64.b64decode()andbase64.urlsafe_b64decode()is now deprecated. In future Python versions they will be errors in the strict mode and discarded in the non-strict mode.gh-140715: Add
'%F'support tostrptime().gh-67041: Add the missing_as_none parameter to
urlparse(),urlsplit()andurldefrag()functions. Add the keep_empty parameter tourlunparse()andurlunsplit()functions. This allows to distinguish between empty and not defined URI components and preserve empty components.gh-77188: The
picklemodule now properly handles name-mangled private methods.
IDLE¶
gh-143774: Better explain the operation of Format / Format Paragraph.
Core and Builtins¶
gh-134584: Optimize and eliminate ref-counting in
_BINARY_OP_SUBSCR_LIST_SLICEgh-144563: Fix interaction of the Tachyon profiler and
ctypesand other modules that load the Python shared library (if present) in an independent map as this was causing the mechanism that loads the binary information to be confused. Patch by Pablo Galindogh-144601: Fix crash when importing a module whose
PyInitfunction raises an exception from a subinterpreter.gh-144549: Fix building the tail calling interpreter on Visual Studio 2026 with free-threading.
gh-144513: Fix potential deadlock when using critical sections during stop-the-world pauses in the free-threaded build.
gh-131798: Optimise
_GUARD_TOS_SLICEin the JIT.gh-144330: Move
classmethodandstaticmethodinitialization from__init__()to__new__(). Patch by Victor Stinner.gh-144446: Fix data races in the free-threaded build when reading frame object attributes while another thread is executing the frame.
gh-120321: Add
gi_state,cr_state, andag_stateattributes to generators, coroutines, and async generators that return the current state as a string (e.g.,GEN_RUNNING). Theinspectmodule functionsgetgeneratorstate(),getcoroutinestate(), andgetasyncgenstate()now return these attributes directly.gh-141563: Fix thread safety of
PyDateTime_IMPORT.gh-144280: Fix a bug in JIT where the predicate symbol had no truthiness
gh-140550: In
PyModuleDef.m_slots, allow slots that repeat information present inPyModuleDef.gh-139103: Improve scaling of
namedtuple()instantiation in the free-threaded build.gh-144307: Prevent a reference leak in module teardown at interpreter finalization.
gh-144319: Add huge pages support for the pymalloc allocator. Patch by Pablo Galindo
gh-120321: Made
gi_yieldfromthread-safe in the free-threading build by using a lightweight lock on the frame state.gh-144194: Fix error handling in perf jitdump initialization on memory allocation failure.
gh-143962: Name suggestion for not normalized name suggests now the normalized name or the closest name to the normalized name. If the suggested name is not ASCII, include also its ASCII representation.
gh-144157:
bytes.translate()now allows the compiler to unroll its loop more usefully for a 2x speedup in the common no-deletions specified case.gh-144068: Fix JIT tracer memory leak, ensure the JIT tracer state is freed when daemon threads are cleaned up during interpreter shutdown.
gh-144012: Check if the result is
NULLinBINARY_OP_EXTENTopcode.gh-144007: Eliminate redundant refcounting in the JIT for
BINARY_OP.gh-144005: Eliminate redundant refcounting from
BINARY_OP_EXTEND.gh-143939: Fix erroneous “cannot reuse already awaited coroutine” error that could occur when a generator was run during the process of clearing a coroutine’s frame.
gh-141805: Fix crash in
setwhen objects with the same hash are concurrently added to the set after removing an element with the same hash while the set still contains elements with the same hash.gh-143670: Fixes a crash in
ga_repr_items_listfunction.gh-143650: Fix race condition in
importlibwhere a thread could receive a stale module reference when another thread’s import fails.gh-143569: Generator expressions in 3.15 now conform to the documented behavior when the iterable does not support iteration. This matches the behavior in 3.14 and earlier
gh-143192: Improve performance of bitwise operations on multi-digit ints.
gh-132657: If we are specializing to
LOAD_GLOBAL_MODULEorLOAD_ATTR_MODULE, try to enable deferred reference counting for the value, if the object is owned by a different thread. This applies to the free-threaded build only and should improve scaling of multi-threaded programs. Note that when deferred reference counting is enabled, the object will be deallocated by the GC, rather than byPy_DECREF().gh-143055: Implement PEP 798 (Unpacking in Comprehensions). Patch by Adam Hartz.
gh-142037: Improve error messages for printf-style formatting. For errors in the format string, always include the position of the start of the format unit. For errors related to the formatted arguments, always include the number or the name of the argument. Raise more specific errors and include more information (type and number of arguments, most probable causes of error).
gh-140557:
bytearraybuffers now have the same alignment when empty as when allocated. Unaligned buffers can still be created by slicing.gh-140232: Frozenset objects with immutable elements are no longer tracked by the garbage collector.
gh-115231: Setup
__module__attribute for built-in static methods. Patch by Sergey B Kirpichev.
C API¶
gh-143869: Added
PyLong_GetNativeLayout(),PyLongLayout,PyLongExport,PyLong_Export(),PyLong_FreeExport(),PyLongWriter,PyLongWriter_Create(),PyLongWriter_Finish()andPyLongWriter_Discard()to the limited API.gh-141070: Renamed
PyUnstable_Object_Dump()toPyObject_Dump().
Build¶
gh-140421: Disable the perf trampoline on older macOS versions where it cannot be built.
gh-144309: Build Python with POSIX 2024, instead of POSIX 2008. Patch by Victor Stinner.
gh-144278: Enables defining the
_PY_IMPL_NAMEand_PY_IMPL_CACHE_TAGpreprocessor definitions to overridesys.implementationat build time. Definitions need to include quotes when setting to a string literal. Setting the cache tag toNULLhas the effect of completely disabling automatic creation and use of.pycfiles.gh-143960: Add support for OpenSSL 3.6, drop EOL 3.2. Patch by Hugo van Kemenade.
gh-143941: Move WASI-related files to
Platforms/WASI. Along the way, leave a deprecatedTools/wasm/wasi/__main__.pybehind for backwards-compatibility.gh-143842: Prevent static builds from clashing with curses by making the optimizer COLORS table static.
Python 3.15.0 alpha 5¶
Release date: 2026-01-14
Windows¶
Tools/Demos¶
gh-142095: Make gdb ‘py-bt’ command use frame from thread local state when available. Patch by Sam Gross and Victor Stinner.
Tests¶
Library¶
gh-143706: Fix
multiprocessingforkserver so thatsys.argvis correctly set before__main__is preloaded. Previously,sys.argvwas empty during main module import in forkserver child processes. This fixes a regression introduced in 3.13.8 and 3.14.1. Root caused by Aaron Wieczorek, test provided by Thomas Watson, thanks!gh-143638: Forbid reentrant calls of the
pickle.Picklerandpickle.Unpicklermethods for the C implementation. Previously, this could cause crash or data corruption, now concurrent calls of methods of the same object raiseRuntimeError.gh-143658:
importlib.metadata: Usestr.translate()to improve performance ofimportlib.metadata.Prepared.normalize(). Patch by Hugo van Kemenade and Henry Schreiner.gh-78724: Raise
RuntimeError’s when user attempts to call methods on half-initializedStructobjects, For example, created byStruct.__new__(Struct). Patch by Sergey B Kirpichev.gh-143196: Fix crash when the internal encoder object returned by undocumented function
json.encoder.c_make_encoder()was called with non-zero second (_current_indent_level) argument.gh-143191:
_thread.stack_size()now raisesValueErrorif the stack size is too small. Patch by Victor Stinner.gh-143547: Fix
sys.unraisablehook()when the hook raises an exception and changessys.unraisablehook(): hold a strong reference to the old hook. Patch by Victor Stinner.gh-139686: Revert 0a97941245f1dda6d838f9aaf0512104e5253929 and 57db12514ac686f0a752ec8fe1c08b6daa0c6219 which made importlib.reload a no-op for lazy modules; caused Buildbot failures.
gh-143517:
annotationlib.get_annotations()no longer raises aSyntaxErrorwhen evaluating a stringified starred annotation that starts with one or more whitespace characters followed by a*. Patch by Bartosz Sławecki.gh-143474: Add
os.RWF_ATOMICconstant for Linux 6.11+.gh-143445: Speed up
copy.deepcopy()by 1.04x.gh-143378: Fix use-after-free crashes when a
BytesIOobject is concurrently mutated duringwrite()orwritelines().gh-143368: Fix endless retry loop in
profiling.samplingblocking mode when threads cannot be seized due toEPERM. Such threads are now skipped instead of causing repeated error messages. Patch by Pablo Galindo.gh-143346: Fix incorrect wrapping of the Base64 data in
plistlib._PlistWriterwhen the indent contains a mix of tabs and spaces.gh-143310:
tkinter: fix a crash when a Pythonlistis mutated during the conversion to a Tcl object (e.g., when setting a Tcl variable). Patch by Bénédikt Tran.gh-143309: Fix a crash in
os.execve()on non-Windows platforms when given a custom environment mapping which is then mutated during parsing. Patch by Bénédikt Tran.gh-143308:
pickle: fix use-after-free crashes when aPickleBufferis concurrently mutated by a custom buffer callback during pickling. Patch by Bénédikt Tran and Aaron Wieczorek.gh-142939: Performance optimisations for
difflib.get_close_matches()gh-124951: The base64 implementation behind the
binascii,base64, and related codec has been optimized for modern pipelined CPU architectures and now performs 2-3x faster across all platforms.gh-143237: Fix support of named pipes in the rotating
logginghandlers.gh-143249: Fix possible buffer leaks in Windows overlapped I/O on error handling.
gh-143241:
zoneinfo: fix infinite loop inZoneInfo.from_filewhen parsing a malformed TZif file. Patch by Fatih Celik.gh-142830:
sqlite3: fix use-after-free crashes when the connection’s callbacks are mutated during a callback execution. Patch by Bénédikt Tran.gh-143200:
xml.etree.ElementTree: fix use-after-free crashes in__getitem__()and__setitem__()methods ofElementwhen the element is concurrently mutated. Patch by Bénédikt Tran.gh-143214: Add the wrapcol parameter in
binascii.b2a_base64()andbase64.b64encode().gh-142195: Updated timeout evaluation logic in
subprocessto be compatible with deterministic environments like Shadow where time moves exactly as requested.gh-140739: Fix several crashes due to reading invalid memory in the new Tachyon sampling profiler. Patch by Pablo Galindo.
gh-142164: Fix the ctypes bitfield overflow error message to report the correct offset and size calculation.
gh-143145: Fixed a possible reference leak in ctypes when constructing results with multiple output parameters on error.
gh-143103: Add padding support to
base64.z85encode()via thepadparameter.gh-130796: Undeprecate the
locale.getdefaultlocale()function. Patch by Victor Stinner.gh-74902: Add the
iter_graphemes()function in theunicodedatamodule to iterate over grapheme clusters according to rules defined in Unicode Standard Annex #29, “Unicode Text Segmentation”. Addgrapheme_cluster_break(),indic_conjunct_break()andextended_pictographic()functions to get the properties of the character which are related to the above algorithm.gh-143004: Fix a potential use-after-free in
collections.Counter.update()when user code mutates the Counter during an update.gh-140648: The
asyncioREPL now respects the-Iflag (isolated mode). Previously, it would load and executePYTHONSTARTUPeven if the flag was set. Contributed by Bartosz Sławecki.gh-142991: Fixed socket operations such as recvfrom() and sendto() for FreeBSD divert(4) socket.
gh-116738: Make the attributes in
lzmathread-safe on the free threaded build.gh-142950: Fix regression in
argparsewhere format specifiers in help strings raisedValueError.gh-142881: Fix concurrent and reentrant call of
atexit.unregister().gh-142615: Fix possible crashes when initializing
asyncio.Taskorasyncio.Futuremultiple times. These classes can now be initialized only once and any subsequent initialization attempt will raise a RuntimeError. Patch by Kumar Aditya.gh-142517: The non-
compat32emailpolicies now correctly handle refolding encoded words that contain bytes that can not be decoded in their specified character set. Previously this resulted in an encoding exception during folding.gh-138122: The Tachyon profiler’s live TUI now integrates with the experimental
_colorizetheming system. Users can customize colors via_colorize.set_theme()(experimental API, subject to change). ALiveProfilerLighttheme is provided for light terminal backgrounds. Patch by Pablo Galindo.gh-142306: Improve errors for
Element.remove.gh-63016: Add a
flagsparameter tommap.mmap.flush()to control synchronization behavior.gh-139262: Some keystrokes can be swallowed in the new
PyREPLon Windows, especially when used together with the ALT key. Fix by Chris Eibl.gh-138897: Improved
license/copyright/creditsdisplay in the REPL: now uses a pager.gh-135852: Add
_winapi.RegisterEventSource(),_winapi.DeregisterEventSource()and_winapi.ReportEvent(). Using these functions inNTEventLogHandlerto replacepywin32.gh-109263: Starting a process from spawn context in
multiprocessingno longer sets the start method globally.gh-132715: Skip writing objects during marshalling once a failure has occurred.
Documentation¶
gh-140806: Add documentation for
enum.bin().
Core and Builtins¶
gh-134584: Eliminate redundant refcounting from
_CONTAINS_OP,_CONTAINS_OP_SETand_CONTAINS_OP_DICT.gh-143604: Fix a reference counting issue in the JIT tracer where the current executor could be prematurely freed during tracing.
gh-143469: Enable
LOAD_ATTR_MODULEspecialization even if__getattr__()is defined in module.gh-134584: Eliminate redundant refcounting from
TO_BOOL_STR.gh-143377: Fix a crash in
_interpreters.capture_exception()when the exception is incorrectly formatted. Patch by Bénédikt Tran.gh-139757: Add
BINARY_OP_SUBSCR_USTR_INTto specialize reading an ASCII character from any string. Patch by Chris Eibl.gh-141504: Factor out tracing and optimization heuristics into a single object. Patch by Donghee Na.
gh-142982: Specialize
CALL_FUNCTION_EXfor Python and non-Python callables.gh-136924: The interactive help mode in the REPL no longer incorrectly syntax highlights text input as Python code. Contributed by Olga Matoula.
gh-139757: Fix unintended bytecode specialization for non-ascii string. Patch by Donghee Na, Ken Jin and Chris Eibl.
gh-143361: Add
PY_VECTORCALL_ARGUMENTS_OFFSETto_Py_CallBuiltinClass_StackRefStealto avoid redundant allocationsgh-131798: The JIT optimizer now understands more generator instructions.
gh-134584: Eliminate redundant refcounting from
_LOAD_ATTR_SLOT.gh-143189: Fix crash when inserting a non-
strkey into a split table dictionary when the key matches an existing key in the split table but has no corresponding value in the dict.gh-143228: Fix use-after-free in perf trampoline when toggling profiling while threads are running or during interpreter finalization with daemon threads active. The fix uses reference counting to ensure trampolines are not freed while any code object could still reference them. Pach by Pablo Galindo
gh-142664: Fix a use-after-free crash in
memoryview.__hash__when the__hash__method of the referenced object mutates that object or the view. Patch by Bénédikt Tran.gh-142557: Fix a use-after-free crash in bytearray.__mod__ when the
bytearrayis mutated while formatting the%-style arguments. Patch by Bénédikt Tran.gh-143195: Fix use-after-free crashes in
bytearray.hex()andmemoryview.hex()when the separator’s__len__()mutates the original object. Patch by Bénédikt Tran.gh-143183: Fix a bug in the JIT when dealing with unsupported control-flow or operations.
gh-142975: Fix crash after unfreezing all objects tracked by the garbage collector on the free threaded build.
gh-143135: Set
sys.flags.inspectto1whenPYTHONINSPECTis0. Previously, it was set to0in this case.gh-143123: Protect the JIT against recursive tracing.
gh-143092: Fix a crash in the JIT when dealing with
list.append(x)style code.gh-143003: Fix an overflow of the shared empty buffer in
bytearray.extend()when__length_hint__()returns 0 for non-empty iterator.gh-143006: Fix a possible assertion error when comparing negative non-integer
floatandintwith the same number of bits in the integer part.gh-116738: Fix thread safety of
contextvars.Context.run().gh-142829: Fix a use-after-free crash in
contextvars.Contextcomparison when a custom__eq__method modifies the context viaset().gh-142863: Generate optimized bytecode when calling
listorsetwith generator expression.gh-41779: Allowed defining any __slots__ for a class derived from
tuple(including classes created bycollections.namedtuple()).gh-69605: Fix edge-cases around already imported modules in the REPL auto-completion of imports.
gh-138568: Adjusted the built-in
help()function so that empty inputs are ignored in interactive mode.gh-131798: Remove bounds check when indexing into tuples with a constant index.
gh-134584: Eliminate redundant refcounting from
_CALL_TYPE_1. Patch by Tomas Roungh-132108: Speed up
int.from_bytes()when passed object supports buffer protocol, likebytearrayby ~1.2x.gh-128334: Make the
sliceclass subscriptable at runtime to be consistent with typing implementation.
C API¶
gh-141671:
PyMODINIT_FUNC(and the newPyMODEXPORT_FUNC) now adds a linkage declaration (__declspec(dllexport)) on Windows.
Python 3.15.0 alpha 4¶
Release date: 2026-01-13
Tests¶
gh-142836: Accommodated Solaris in
test_pdb.test_script_target_anonymous_pipe.
Library¶
gh-122431: Corrected the error message in
readline.append_history_file()to state thatnelementsmust be non-negative instead of positive.gh-143046: The
asyncioREPL no longer prints copyright and version messages in the quiet mode (-q). Patch by Bartosz Sławecki.gh-80744: Fix issue where
pdbwould read a.pdbrctwice if launched from the home directorygh-138122: Add blocking mode to Tachyon for accurate stack traces in applications with many generators or fast-changing call stacks. Patch by Pablo Galindo.
gh-143010: Fixed a bug in
mailboxwhere the precise timing of an external event could result in the library opening an existing file instead of a file it expected to create.gh-112127: Fix possible use-after-free in
atexit.unregister()when the callback is unregistered during comparison.gh-138122: Fix incomplete stack traces in the Tachyon profiler’s frame cache when profiling code with deeply nested generators. The frame cache now validates that stack traces reach the base frame before caching, preventing broken flamegraphs. Patch by Pablo Galindo.
gh-142834: Change the
pdbcommandscommand to use the last available breakpoint instead of failing when the most recently created breakpoint was deleted.gh-142783: Fix zoneinfo use-after-free with descriptor _weak_cache. a descriptor as _weak_cache could cause crashes during object creation. The fix ensures proper reference counting for descriptor-provided objects.
gh-76007: Deprecate
VERSIONfromxml.etree.ElementTreeandversionfromxml.sax.expatreaderandxml.sax.handler. Patch by Hugo van Kemenade.gh-142784: The
asyncioREPL now properly closes the loop upon the end of interactive session. Previously, it could cause surprising warnings. Contributed by Bartosz Sławecki.gh-138122: Add binary output format to
profiling.samplingfor compact storage of profiling data. The new--binaryoption captures samples to a file that can be converted to other formats using thereplaycommand. Patch by Pablo Galindogh-142495:
collections.defaultdictnow prioritizes__setitem__()when inserting default values fromdefault_factory. This prevents race conditions where a default value would overwrite a value set beforedefault_factoryreturns.gh-142654: Show the clearer error message when using
profiling.samplingon an unknown PID.gh-142560: Fix use-after-free in
bytearraysearch-like methods (find(),count(),index(),rindex(), andrfind()) by marking the storage as exported which causes reallocation attempts to raiseBufferError. Forcontains(),split(), andrsplit()the buffer protocol is used for this.gh-142419:
mmap.mmap.set_name()method added to annotate an anonymous memory map if Linux kernel supportsPR_SET_VMA_ANON_NAME(Linux 5.17 or newer). Patch by Donghee Na.gh-139971:
pydoc: Ensure that the link to the online documentation of a stdlib module is correct.gh-124098: Fix issue where methods in handlers that lacked the protocol name but matched a valid base handler method (e.g.,
_open()orerror()) were incorrectly added tourllib.request.OpenerDirector’s handlers. Contributed by Andrea Mattei.gh-136282: Add support for
UNNAMED_SECTIONwhen creating a section via the mapping protocol access
Core and Builtins¶
gh-143057: Avoid locking in
PyTraceMalloc_Track()andPyTraceMalloc_Untrack()whentracemallocis not enabled.gh-139109: Add missing terminator in certain cases when tracing in the new JIT compiler.
gh-142961: Fix a segfault in the JIT when constant folding
len(tuple).gh-142776: Fix a file descriptor leak in import.c
gh-139757: Fix building JIT stencils on free-threaded builds.
gh-129068: Make concurrent iteration over the same range iterator thread-safe in the free threading build.
gh-142543: Fix a stack overflow on Clang JIT build configurations with full LTO.
gh-142448: Fix a bug when using monitoring with the JIT.
gh-142766: Clear the frame of a generator when
generator.close()is called.gh-134584: Eliminate redundant refcounting from
_LOAD_ATTR_INSTANCE_VALUE.gh-134584: Eliminate redundant refcounting from
_STORE_ATTR_WITH_HINT.gh-142476: Fix a memory leak in the experimental Tier 2 optimizer when creating executors. Patched by Shamil Abdulaev.
gh-100964: Fix reference cycle in exhausted generator frames. Patch by Savannah Ostrowski.
gh-139922: Allow building CPython with the tail calling interpreter on Visual Studio 2026 MSVC. This provides a performance gain over the prior interpreter for MSVC. Patch by Ken Jin, Brandt Bucher, and Chris Eibl. With help from the MSVC team including Hulon Jenkins.
Python 3.15.0 alpha 3¶
Release date: 2025-12-16
Tools/Demos¶
gh-141692: Each slice of an iOS XCframework now contains a
libfolder that contains a symlink to the libpython dylib. This allows binary modules to be compiled for iOS using dynamic libreary linking, rather than Framework linking.
Tests¶
gh-140381: Fix flaky test_profiling tests on i686 and s390x architectures by increasing slow_fibonacci call frequency from every 5th iteration to every 2nd iteration.
gh-140210: Make
test_sysconfig.test_parse_makefile_renamed_varsless fragile by clearing the environment variables before parsing the Makefile.
Security¶
gh-142145: Remove quadratic behavior in
xml.minidomnode ID cache clearing.gh-42400: Fix buffer overflow in
_Py_wrealpath()for paths exceedingMAXPATHLENbytes by using dynamic memory allocation instead of fixed-size buffer. Patch by Shamil Abdulaev.gh-119451: Fix a potential memory denial of service in the
http.clientmodule. When connecting to a malicious server, it could cause an arbitrary amount of memory to be allocated. This could have led to symptoms including aMemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.gh-119342: Fix a potential memory denial of service in the
plistlibmodule. When reading a Plist file received from untrusted source, it could cause an arbitrary amount of memory to be allocated. This could have led to symptoms including aMemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.
Library¶
gh-142754: Add the ownerDocument attribute to
xml.dom.minidomelements and attributes created by directly instantiating theElementorAttrclass. Note that this way of creating nodes is not supported; creator functions likexml.dom.Document.documentElement()should be used instead.gh-142594: Fix crash in
TextIOWrapper.close()when the underlying buffer’sclosedproperty callsdetach().gh-76007: Deprecate
__version__fromctypes. Patch by Hugo van Kemenade.gh-76007: Deprecate
__version__fromwsgiref.simple_server. Patch by Hugo van Kemenade.gh-142651:
unittest.mock: fix a thread safety issue whereMock.call_countmay return inaccurate values when the mock is called concurrently from multiple threads.gh-76007: Deprecate
__version__fromhttp.server. Patch by Hugo van Kemenade.gh-138122: Add
--subprocessesflag toprofiling.samplingCLI to automatically profile subprocesses spawned by the target. When enabled, the profiler monitors for new Python subprocesses and profiles each one separately, writing results to individual output files. This is useful for profiling applications that usemultiprocessing,ProcessPoolExecutor, or other subprocess-based parallelism. Patch by Pablo Galindo.gh-142595: Added type check during initialization of the
decimalmodule to prevent a crash in case of broken stdlib. Patch by Sergey B Kirpichev.gh-142556: Fix crash when a task gets re-registered during finalization in
asyncio. Patch by Kumar Aditya.gh-138122: Add
--mode=exceptionto the sampling profiler to capture samples only from threads with an active exception, useful for analyzing exception handling overhead. Patch by Pablo Galindo.gh-142539:
traceback: Fix location of carets inSyntaxErrors when the source contains wide characters.gh-123241: Avoid reference count operations in garbage collection of
ctypesobjects.gh-142451:
hmac: correctly copyHMACattributes for objects copied throughHMAC.copy(). Patch by Bénédikt Tran.gh-138122: The
profiling.samplingflamegraph profiler now supports inverted flamegraph view that aggregates all leaf nodes. In a standard flamegraph, if a hot function is called from multiple locations, it appears multiple times as separate leaf nodes. In the inverted flamegraph, all occurrences of the same leaf function are merged into a single aggregated node at the root, showing the total hotness of that function in one place. The children of each aggregated node represent its callers, making it easier to identify which functions consume the most CPU time and where they are called from.gh-112527: The help text for required options in
argparseno longer extended with “ (default: None)”.gh-142438: Fixed a possible leaked GIL in _PySSL_keylog_callback.
gh-138122: Add bytecode-level instruction profiling to the sampling profiler via the new
--opcodesflag. When enabled, the profiler captures which bytecode opcode is executing at each sample, including Python 3.11+ adaptive specializations, and visualizes this data in the heatmap, flamegraph, gecko, and live output formats. Patch by Pablo Galindogh-142389: Add backtick markup support in
argparsedescription and epilog text to highlight inline code when color output is enabled.gh-142346: Fix usage formatting for mutually exclusive groups in
argparsewhen they are preceded by positional arguments or followed or intermixed with other optional arguments.gh-142374: Fix cumulative percentage calculation for recursive functions in the new sampling profiler. When profiling recursive functions, cumulative statistics (cumul%, cumtime) could exceed 100% because each recursive frame in a stack was counted separately. For example, a function recursing 500 times in every sample would show 50000% cumulative presence. The fix deduplicates locations within each sample so cumulative stats correctly represent “percentage of samples where this function was on the stack”. Patch by Pablo Galindo.
gh-142315: Pdb can now run scripts from anonymous pipes used in process substitution. Patch by Bartosz Sławecki.
gh-64532: Subparser help now includes required optional arguments from the parent parser in the usage, making it clearer what arguments are needed to run a subcommand. Patch by Savannah Ostrowski.
gh-142207: Fix: profiling.sampling may cause assertion
!(has_gil && gil_requested)gh-142332: Fix usage formatting for positional arguments in mutually exclusive groups in
argparse. inargparse.gh-142282: Fix
winreg.QueryValueEx()to not accidentally read garbage buffer under race condition.gh-142318: Fix typing
'q'at the help of the interactive tachyon profiler exiting the profiler.gh-75949: Fix
argparseto preserve|separators in mutually exclusive groups when the usage line wraps due to length.gh-142267: Improve
argparseperformance by caching the formatter used for argument validation.gh-139862: Remove
colorparameter fromargparse.HelpFormatterconstructor. Color is controlled byArgumentParser.gh-68552:
MisplacedEnvelopeHeaderDefectandMissing header namedefects are now correctly passed to thehandle_defectmethod ofpolicyinFeedParser.gh-142206: The resource tracker in the
multiprocessingmodule can now understand messages from older versions of itself. This avoids issues with upgrading Python while it is running. (Note that such ‘in-place’ upgrades are not tested.)gh-142214: Fix two regressions in
dataclassesin Python 3.14.1 related to annotations.An exception is no longer raised if
slots=Trueis used and the__init__method does not have an__annotate__attribute (likely becauseinit=Falsewas used).An exception is no longer raised if annotations are requested on the
__init__method and one of the fields is not present in the class annotations. This can occur in certain dynamic scenarios.
Patch by Jelle Zijlstra.
gh-142203: Remove the debug_override parameter from
importlib.util.cache_from_source()which has been deprecated since Python 3.5.gh-138122: The
_remote_debuggingmodule now implements frame caching in theRemoteUnwinderclass to reduce memory reads when profiling remote processes. Whencache_frames=True, unchanged portions of the call stack are reused from previous samples, significantly improving profiling performance for deep call stacks.gh-116738: Fix
cmathdata race when initializing trigonometric tables with subinterpreters.gh-141982: Allow
pdbto set breakpoints on async functions with function names.gh-74389: When the stdin being used by a
subprocess.Popeninstance is closed, this is now ignored insubprocess.Popen.communicate()instead of leaving the class in an inconsistent state.gh-87512: Fix
subprocess.Popen.communicate()timeout handling on Windows when writing large input. Previously, the timeout was ignored during stdin writing, causing the method to block indefinitely if the child process did not consume input quickly. The stdin write is now performed in a background thread, allowing the timeout to be properly enforced.gh-141939: Add color to all interpolated values in
argparsehelp, like%(default)sor%(choices)s. Patch by Alex Prengère.gh-141473: When
subprocess.Popen.communicate()was called with input and a timeout and is called for a second time after aTimeoutExpiredexception before the process has died, it should no longer hang.gh-141999: Correctly allow
KeyboardInterruptto stop the process when usingprofiling.sampling.gh-142006: Fix a bug in the
email.policy.defaultfolding algorithm which incorrectly resulted in a doubled newline when a line ending at exactly max_line_length was followed by an unfoldable token.gh-141968: Remove data copy from
recompilation of regexes with large charsets by usingbytearray.take_bytes().gh-141968: Remove data copy from
encodings.idnaencode()andencode()by usingbytearray.take_bytes().gh-141968: Remove data copy from
codecspunycodeencoding by usingbytearray.take_bytes().gh-141968: Remove data copy from
wave.Wave_read.readframes()andwave.Wave_write.writeframes()by usingbytearray.take_bytes().gh-141968: Remove a data copy from
base64.b32decode()andbase64.b32encode()by usingbytearray.take_bytes().gh-59000: Fix
pdbbreakpoint resolution for class methods when the module defining the class is not imported.gh-116738: Fix thread safety issue with
rescanner objects in free-threaded builds.gh-138122: The
profiling.samplingflamegraph profiler now displays thread status statistics showing the percentage of time threads spend holding the GIL, running without the GIL, waiting for the GIL, and performing garbage collection. These statistics help identify GIL contention and thread behavior patterns. When filtering by thread, the display shows per-thread metrics.gh-141781: Fixed an issue where pdb.line_prefix assignment was ignored if assigned after the module was imported.
gh-141863: Update Streams to use
bytearray.take_bytes()for a over 10% performance improvement on pyperformance asyncio_tcp benchmark.gh-141817: Add
socket.IPV6_HDRINCLconstant.gh-105836: Fix
asyncio.run_coroutine_threadsafe()leaving underlying cancelled asyncio task running.gh-141570: Support file-like object raising
OSErrorfromfileno()in color detection (_colorize.can_colorize()). This can occur whensys.stdoutis redirected.gh-141679: Add colour to defaults in
argparsehelp. Patch by Hugo van Kemenade.gh-141686: Break reference cycles created by each call to
json.dump()orjson.JSONEncoder.iterencode().gh-141659: Fix bad file descriptor errors from
_posixsubprocesson AIX.gh-141645: Add a new
--livemode to the tachyon profiler inprofiling.samplingmodule. This mode consist of a live TUI that displays real-time profiling statistics as the target application runs, similar totop. Patch by Pablo Galindogh-141615: Check
stdininstead ofstdoutforuse_rawinputinpdb.gh-69113: Fix
doctestto correctly report line numbers for doctests in__test__dictionary when formatted as triple-quoted strings by finding unique lines in the string and matching them in the source file.gh-141600: Fix musl version detection on Void Linux.
gh-48752: Add
readline.get_pre_input_hook()function to retrieve the current pre-input hook. This allows applications to save and restore the hook without overwriting user settings. Patch by Sanyam Khurana.gh-141565: Add async-aware profiling to the Tachyon sampling profiler. The profiler now reconstructs and displays async task hierarchies in flamegraphs, making the output more actionable for users. Patch by Savannah Ostrowski and Pablo Galindo Salgado.
gh-60107: Remove a copy from
io.RawIOBase.read(). If the underlying I/O class keeps a reference to the mutable memory, raise aBufferError.gh-116738: Make csv module thread-safe on the free threaded build.
gh-140911:
collections: Ensure that the methodsUserString.rindex()andUserString.index()acceptcollections.UserStringinstances as the sub argument.gh-140875: Fix handling of unclosed character references (named and numerical) followed by the end of file in
html.parser.HTMLParserwithconvert_charrefs=False.gh-140677: Add heatmap visualization mode to the Tachyon sampling profiler. The new
--heatmapoutput format provides a line-by-line view showing execution intensity with color-coded samples, inline statistics, and interactive call graph navigation between callers and callees.gh-139946: Distinguish stdout and stderr when colorizing output in argparse module.
gh-76007:
pydoc: FixDeprecationWarningbeing raised when generating doc for stdlib modules.gh-138697: Fix inferring dest from a single-dash long option in
argparse. If a short option and a single-dash long option are passed toadd_argument(), dest is now inferred from the single-dash long option.gh-138525: Add support for single-dash long options and alternate prefix characters in
argparse.BooleanOptionalAction.gh-79986: Add parsing for
ReferencesandIn-Reply-Toheaders to theemaillibrary that parses the header content as lists of message id tokens. This prevents them from being folded incorrectly.gh-135559: Flag: a
dir()on aFlagenumeration now shows non-canonical members. (i.e. aliases).gh-134453: Fixed
subprocess.Popen.communicate()input=handling ofmemoryviewinstances that were non-byte shaped on POSIX platforms. Those are now properly cast to a byte shaped view instead of truncating the input. Windows platforms did not have this bug.gh-127930: Add
__all__totkinter.simpledialog.gh-115952: Fix a potential memory denial of service in the
picklemodule. When reading a pickled data received from untrusted source, it could cause an arbitrary amount of memory to be allocated, even if the code that is allowed to execute is restricted by overriding thefind_class()method. This could have led to symptoms including aMemoryError, swapping, out of memory (OOM) killed processes or containers, or even system crashes.bpo-40350: Fix support for namespace packages in
modulefinder.
Documentation¶
gh-141994:
xml.sax.handler: Make Documentation ofxml.sax.handler.feature_external_geswarn of opening up to external entity attacks. Patch by Sebastian Pipping.
Core and Builtins¶
gh-134584: Eliminate redundant refcounting from
_STORE_ATTR_INSTANCE_VALUE.gh-142718: JIT: Fix segfault caused by not flushing the stack to memory at side exits.
gh-142737: Tracebacks will be displayed in fallback mode even if
io.open()is lost. Previously, this would crash the interpreter. Patch by Bartosz Sławecki.gh-116738: Make the attributes in
bz2thread-safe on the free threaded build.gh-134584: Eliminate redundant refcounting from
_CALL_LIST_APPEND.gh-142554: Fix a crash in
divmod()when_pylong.int_divmod()does not return a tuple of length two exactly. Patch by Bénédikt Tran.gh-142531: Fix a free-threaded GC performance regression. If there are many untracked tuples, the GC will run too often, resulting in poor performance. The fix is to include untracked tuples in the “long lived” object count. The number of frozen objects is also now included since the free-threaded GC must scan those too.
gh-142402: Fix reference counting when adjacent literal parts are merged while constructing
string.templatelib.Template, preventing the displaced string object from leaking.gh-116738: Make the attributes in
zlibthread-safe on the free threaded build.gh-142343: Fix SIGILL crash on m68k due to incorrect assembly constraint.
gh-142236: Improve the “Perhaps you forgot a comma?” syntax error for multi-line string concatenations to point to the last string instead of the first, making it easier to locate where the comma is missing. Patch by Pablo Galindo.
gh-142236: Fix incorrect keyword suggestions for syntax errors in
traceback. The keyword typo suggestion mechanism would incorrectly suggest replacements when the extracted source code was incomplete rather than containing an actual typo. Patch by Pablo Galindo.gh-142305: Decrease the size of the generated stencils and the runtime JIT code. Patch by Diego Russo.
gh-135379: Implement a limited form of register allocation known as “top of stack caching” in the JIT. It works by keeping 0-3 of the top items in the stack in registers. The code generator generates multiple versions of those uops that do not escape and are relatively small. During JIT compilation, the copy that produces the least memory traffic is selected, spilling or reloading values when needed.
gh-142276: Fix missing type watcher when promoting attribute loads to constants in the JIT. Patch by Ken Jin. Reproducer by Yuancheng Jiang.
gh-142218: Fix crash when inserting into a split table dictionary with a non
strkey that matches an existing key.gh-141976: Check against abstract stack overflow in the JIT optimizer.
gh-97850: Remove all
*.load_module()usage and definitions from the import system and importlib. The method has been deprecated in favor ofimportlib.abc.Loader.exec_module()since Python 3.4.gh-142048: Fix quadratically increasing garbage collection delays in free-threaded build.
gh-65961: Stop setting
__cached__on modules.gh-141770: Annotate anonymous mmap usage only when supported by the Linux kernel and if
-X devis used or Python is built in debug mode. Patch by Donghee Na.gh-142029: Raise
ModuleNotFoundErrorinstead of crashing when a nonexistent module is used as a name in_imp.create_builtin().gh-142029: Raise
ValueErrorinstead of crashing when empty string is used as a name in_imp.create_builtin().gh-141976: Protect against specialization failures in the tracing JIT compiler for performance reasons.
gh-141861: Fix invalid memory read in the
ENTER_EXECUTORinstruction.gh-141930: When importing a module, use Python’s regular file object to ensure that writes to
.pycfiles are complete or an appropriate error is raised.gh-138122: Add incomplete sample detection to prevent corrupted profiling data. Each thread state now contains an embedded base frame (sentinel at the bottom of the frame stack) with owner type
FRAME_OWNED_BY_INTERPRETER. The profiler validates that stack unwinding terminates at this sentinel frame. Samples that fail to reach the base frame (due to race conditions, memory corruption, or other errors) are now rejected rather than being included as spurious data.gh-120158: Fix inconsistent state when enabling or disabling monitoring events too many times.
gh-140638: Expose a
"candidates"stat ingc.get_stats()andgc.callbacks.gh-141780: Fix
Py_mod_gilwith API added in PEP 793:PyModule_FromSlotsAndSpec()andPyModExporthooksgh-141732: Ensure the
__repr__()forExceptionGroupandBaseExceptionGroupdoes not change when the exception sequence that was original passed in to its constructor is subsequently mutated.gh-140638: Expose a
"duration"stat ingc.get_stats()andgc.callbacks.gh-139653: Only raise a
RecursionErroror trigger a fatal error if the stack pointer is both below the limit pointer and above the stack base. If outside of these bounds assume that it is OK. This prevents false positives when user-space threads swap stacks.gh-41779: Allowed defining the __dict__ and __weakref__ __slots__ for any class.
gh-139103: Improve multithreaded scaling of dataclasses on the free-threaded build.
gh-141589: Change
backoff counterto use prime numbers instead of powers of 2. Use only 3 bits forcounterand 13 bits forvalue. This allows to support values up to 8191. Patch by Mikhail Efimov.gh-137007: Fix a bug during JIT compilation failure which caused garbage collection debug assertions to fail.
gh-132657: For the free-threaded build, avoid locking the
setobject for the__contains__method.gh-134584: Eliminate redundant refcounting from
_CALL_STR_1.gh-134584: Eliminate redundant refcounting from
_CALL_BUILTIN_O.gh-134584: Eliminate redundant refcounting from
_CALL_TUPLE_1. Patch by Noam Cohen
C API¶
gh-142589: Fix
PyUnstable_Object_IsUniqueReferencedTemporary()handling of tagged ints on the interpreter stack.gh-142571:
PyUnstable_CopyPerfMapFile()now checks that opening the file succeeded before flushing.gh-142225: Fixed the
PyABIInfo_VARmacro.gh-141049:
_PyObject_CallMethodId(),_PyObject_GetAttrId()and_PyUnicode_FromId()are deprecated since 3.15 and will be removed in 3.20. Instead, usePyUnicode_InternFromString()and cache the result in the module state, then callPyObject_CallMethod()orPyObject_GetAttr(). Patch by Victor Stinner.gh-142163: Fix the
HAVE_THREAD_LOCALmacro being defined without thePy_BUILD_COREmacro set after includingPython.h.gh-137422: Fix free threading race condition in
PyImport_AddModuleRef(). It was previously possible for two calls to the function return two different objects, only one of which was stored insys.modules.gh-141726: Add
PyDict_SetDefaultRef()to the Stable ABI.gh-140042: Removed the sqlite3_shutdown call that could cause closing connections for sqlite when used with multiple sub interpreters.
gh-141070: Add
PyUnstable_Object_Dump()to dump an object tostderr. It should only be used for debugging. Patch by Victor Stinner.gh-139165: Expose the functions
Py_SIZE(),Py_IS_TYPE()andPy_SET_SIZE()in the Stable ABI.
Build¶
gh-131372: Add
LDVERSIONandEXEto thebase_interpretervalue ofbuild-details.json.gh-142454: When calculating the digest of the JIT stencils input, sort the hashed files by filenames before adding their content to the hasher. This ensures deterministic hash input and hence deterministic hash, independent on filesystem order.
gh-131372:
build-details.pywill only be installed as part of the main install (make install).make altinstallwill no longer include it.gh-142234: Allow
--enable-wasm-dynamic-linkingfor WASI. While CPython doesn’t directly support it so external/downstream users do not have to patch in support for the flag.gh-142050: Fixed a bug where JIT stencils produced on Windows contained debug data. Patch by Chris Eibl.
gh-141808: Do not generate the jit stencils twice in case of PGO builds on Windows.
gh-141926:
RUNSHAREDis no longer cleared when cross-compiling. Previously,RUNSHAREDwas cleared when cross-compiling, which breaks PGO when using--enabled-sharedon systems where the cross-compiled CPython is otherwise executable (e.g., via transparent emulation).gh-141808: When running
make clean-retain-profile, keep the generated JIT stencils. That way, the stencils are not generated twice when Profile-guided optimization (PGO) is used. It also allows distributors to supply their own pre-built JIT stencils.gh-141784: Fix
_remote_debugging_module.ccompilation on 32-bit Linux. Include Python.h before system headers to make sure that_remote_debugging_module.cuses the same types (ABI) than Python. Patch by Victor Stinner.gh-141172: Update to WASI SDK 29.
gh-139707: Add configure option
--with-missing-stdlib-config=FILEallows which distributors to pass a JSON configuration file containing custom error messages for missing standard library modules.gh-108819: Honor
--with-platlibdirin the pure-Python standard library installation path, ifPLATLIBDIRdoesn’t match the value used inLIBDIR.
Python 3.15.0 alpha 2¶
Release date: 2025-11-18
Windows¶
gh-140849: Update bundled liblzma to version 5.8.1.
Tools/Demos¶
Tests¶
gh-140482: Preserve and restore the state of
stty echoas part of the test environment.gh-140082: Update
python -m testto setFORCE_COLOR=1when being run with color enabled so thatunittestwhich is run by it with redirected output will output in color.gh-136442: Use exitcode
1instead of5ifunittest.TestCase.setUpClass()raises an exception
Security¶
gh-137836: Add support of the “plaintext” element, RAWTEXT elements “xmp”, “iframe”, “noembed” and “noframes”, and optionally RAWTEXT element “noscript” in
html.parser.HTMLParser.gh-136063:
email.message: ensure linear complexity for legacy HTTP parameters parsing. Patch by Bénédikt Tran.gh-136065: Fix quadratic complexity in
os.path.expandvars().
Library¶
gh-141497:
ipaddress: ensure that the methodsIPv4Network.hosts()andIPv6Network.hosts()always return an iterator.gh-140938: The
statistics.stdev()andstatistics.pstdev()functions now raise aValueErrorwhen the input contains an infinity or a NaN.gh-124111: Updated Tcl threading configuration in
_tkinterto assume that threads are always available in Tcl 9 and later.gh-137109: The
os.forkand related forking APIs will no longer warn in the common case where Linux or macOS platform APIs return the number of threads in a process and find the answer to be 1 even when aos.register_at_fork()after_in_parent=callback (re)starts a thread.gh-141314: Fix assertion failure in
io.TextIOWrapper.tell()when reading files with standalone carriage return (\r) line endings.gh-141311: Fix assertion failure in
io.BytesIO.readinto()and undefined behavior arising when read position is above capcity inio.BytesIO.gh-87710:
mimetypes: Update mime type for.aifiles toapplication/pdf.gh-85524: Update
io.FileIO.readall, an implementation ofio.RawIOBase.readall(), to followio.IOBaseguidelines and raiseio.UnsupportedOperationwhen a file is in “w” mode rather thanOSErrorgh-141141: Fix a thread safety issue with
base64.b85decode(). Contributed by Benel Tayar.gh-141018:
mimetypes: Update.exe,.dll,.rtfand (whenstrict=False).jpgto their correct IANA mime type.gh-137969: Fix
annotationlib.ForwardRef.evaluate()returningForwardRefobjects which don’t update with new globals.gh-75593: Add support of path-like objects and bytes-like objects in
wave.open().gh-140797: The undocumented
re.Scannerclass now forbids regular expressions containing capturing groups in its lexicon patterns. Patterns using capturing groups could previously lead to crashes with segmentation fault. Use non-capturing groups (?:…) instead.gh-125115: Refactor the
pdbparsing issue so positional arguments can pass through intuitively.gh-140815:
faulthandlernow detects if a frame or a code object is invalid or freed. Patch by Victor Stinner.gh-100218: Correctly set
errnowhensocket.if_nametoindex()orsocket.if_indextoname()raise anOSError. Patch by Bénédikt Tran.gh-140734:
multiprocessing: fix off-by-one error when checking the length of a temporary socket file path. Patch by Bénédikt Tran.gh-140873: Add support of non-descriptor callables in
functools.singledispatchmethod().gh-140874: Bump the version of pip bundled in ensurepip to version 25.3
gh-140826: Now
winreg.HKEYTypeobjects are compared by their underlying Windows registry handle value instead of their object identity.gh-140808: The internal class
mailbox._ProxyFileis no longer a parameterized generic.gh-140691: In
urllib.request, when opening a FTP URL fails because a data connection cannot be made, the control connection’s socket is now closed to avoid aResourceWarning.gh-103847: Fix hang when cancelling process created by
asyncio.create_subprocess_exec()orasyncio.create_subprocess_shell(). Patch by Kumar Aditya.gh-137821: Convert
_jsonmodule to use Argument Clinic. Patched by Yoonho Hann.gh-140790: Initialize all Pdb’s instance variables in
__init__, remove some hasattr/getattrgh-140766: Add
enum.show_flag_values()andenum.bintoenum.__all__.gh-120057: Add
os.reload_environ()toos.__all__.gh-140741: Fix
profiling.sampling.sample()incorrectly handling aFileNotFoundErrororPermissionError.gh-140228: Avoid making unnecessary filesystem calls for frozen modules in
linecachewhen the global module cache is not present.gh-139946: Error and warning keywords in
argparse.ArgumentParsermessages are now colorized when color output is enabled, fixing a visual inconsistency in which they remained plain text while other output was colorized.gh-140590: Fix arguments checking for the
functools.partial.__setstate__()that may lead to internal state corruption and crash. Patch by Sergey Miryanov.gh-125434: Display thread name in
faulthandleron Windows. Patch by Victor Stinner.gh-140634: Fix a reference counting bug in
os.sched_param.__reduce__().gh-140650: Fix an issue where closing
io.BufferedWritercould crash if the closed attribute raised an exception on access or could not be converted to a boolean.gh-140633: Ignore
AttributeErrorwhen setting a module’s__file__attribute when loading an extension module packaged as Apple Framework.gh-140601:
xml.etree.ElementTree.iterparse()now emits aResourceWarningwhen the iterator is not explicitly closed and was opened with a filename. This helps developers identify and fix resource leaks. Patch by Osama Abdelkader.gh-140593:
xml.parsers.expat: Fix a memory leak that could affect users withElementDeclHandler()set to a custom element declaration handler. Patch by Sebastian Pipping.gh-140607: Inside
io.RawIOBase.read(), validate that the count of bytes returned byio.RawIOBase.readinto()is valid (inside the provided buffer).gh-138162: Fix
logging.LoggerAdapterwithmerge_extra=Trueand without the extra argument.gh-140481: Improve error message when trying to iterate a Tk widget, image or font.
gh-138774:
ast.unparse()now generates full source code when handlingast.Interpolationnodes that do not have a specified source.gh-140474: Fix memory leak in
array.arraywhen creating arrays from an emptystrand theutype code.gh-140448: Change the default of
suggest_on_errortoTrueinargparse.ArgumentParser.gh-137530:
dataclassesFix annotations for generated__init__methods by replacing the annotations that were in-line in the generated source code with__annotate__functions attached to the methods.gh-140348: Fix regression in Python 3.14.0 where using the
|operator on atyping.Unionobject combined with an object that is not a type would raise an error.gh-76007:
decimal: Deprecate__version__and replace withdecimal.SPEC_VERSION.gh-76007: Deprecate
__version__fromimaplib. Patch by Hugo van Kemenade.gh-140272: Fix memory leak in the
clear()method of thedbm.gnudatabase.gh-129117:
unicodedata: Addisxidstart()andisxidcontinue()functions to check whether a character can start or continue a Unicode Standard Annex #31 identifier.gh-140251: Colorize the default import statement
import asyncioin asyncio REPL.gh-140212: Calendar’s HTML formatting now accepts year and month as options. Previously, running
python -m calendar -t html 2025 10would result in an error message. It now generates an HTML document displaying the calendar for the specified month. Contributed by Pål Grønås Drange.gh-135801: Improve filtering by module in
warnings.warn_explicit()if no module argument is passed. It now tests the module regular expression in the warnings filter not only against the filename with.pystripped, but also against module names constructed starting from different parent directories of the filename (with/__init__.py,.pyand, on Windows,.pywstripped).gh-139707: Improve
ModuleNotFoundErrorerror message when a standard library module is missing.gh-140041: Fix import of
ctypeson Android and Cygwin when ABI flags are present.gh-140120: Fixed a memory leak in
hmacwhen it was using the hacl-star backend. Discovered by@ashm-devusing AddressSanitizer.gh-140141: The
importlib.metadata.PackageNotFoundErrortraceback raised whenimportlib.metadata.Distribution.from_namecannot discover a distribution no longer includes a transientStopIterationexception trace.Contributed by Bartosz Sławecki in gh-140142.
gh-140166:
mimetypes: Per the IANA assignment, update the MIME type for the.texiand.texinfofile formats toapplication/texinfo, instead ofapplication/x-texinfo.gh-140135: Speed up
io.RawIOBase.readall()by using PyBytesWriter API (about 4x faster)gh-76007:
zlib: Deprecate__version__and schedule for removal in Python 3.20.gh-136702:
encodings: Deprecate passing a non-ascii encoding name toencodings.normalize_encoding()and schedule removal of support for Python 3.17.gh-139940: Print clearer error message when using
pdbto attach to a non-existing process.gh-139462: When a child process in a
concurrent.futures.ProcessPoolExecutorterminates abruptly, the resulting traceback will now tell you the PID and exit code of the terminated process. Contributed by Jonathan Berg.gh-63161: Fix
tokenize.detect_encoding(). Support non-UTF-8 shebang and comments if non-UTF-8 encoding is specified. Detect decoding error for non-UTF-8 encoding. Detect null bytes in source code.gh-101828: Fix
'shift_jisx0213','shift_jis_2004','euc_jisx0213'and'euc_jis_2004'codecs truncating null chars as they were treated as part of multi-character sequences.gh-139246: fix: paste zero-width in default repl width is wrong.
gh-83714: Implement
os.statx()on Linux kernel versions 4.11 and later with glibc versions 2.28 and later. Contributed by Jeffrey Bosboom and Victor Stinner.gh-138891: Fix
SyntaxErrorwheninspect.get_annotations(f, eval_str=True)is called on a function annotated with a PEP 646star_expressiongh-138859: Fix generic type parameterization raising a
TypeErrorwhen omitting aParamSpecthat has a default which is not a list of types.gh-138764: Prevent
annotationlib.call_annotate_function()from calling__annotate__functions that don’t supportVALUE_WITH_FAKE_GLOBALSin a fake globals namespace with empty globals.Make
FORWARDREFandSTRINGannotations fall back to usingVALUEannotations in the case that neither their own format, norVALUE_WITH_FAKE_GLOBALSare supported.gh-138775: Use of
python -mwithbase64has been fixed to detect input from a terminal so that it properly notices EOF.gh-98896: Fix a failure in multiprocessing resource_tracker when SharedMemory names contain colons. Patch by Rani Pinchuk.
gh-138425: Fix partial evaluation of
annotationlib.ForwardRefobjects which rely on names defined as globals.gh-138151: In
annotationlib, improve evaluation of forward references to nonlocal variables that are not yet defined when the annotations are initially evaluated.gh-69528: The
modeattribute of files opened in the'wb+'mode is now'wb+'instead of'rb+'.gh-137627: Speed up
csv.Sniffer.sniff()delimiter detection by up to 1.6x.gh-55531:
encodings: Improvenormalize_encoding()performance by implementing the function in C using the private_Py_normalize_encodingwhich has been modified to make lowercase conversion optional.gh-136057: Fixed the bug in
pdbandbdbwherenextandstepcan’t go over the line if a loop exists in the line.gh-133390: Support table, index, trigger, view, column, function, and schema completion for
sqlite3’s command-line interface.gh-135307:
email: Fix exception inset_content()when encoding text and max_line_length is set to0orNone(unlimited).gh-133789: Fix unpickling of
pathlibobjects that were pickled in Python 3.13.gh-133601: Remove deprecated
typing.no_type_check_decorator().gh-132686: Add parameters inherit_class_doc and fallback_to_class_doc for
inspect.getdoc().gh-131116:
inspect.getdoc()now correctly returns an inherited docstring oncached_propertyobjects if none is given in a subclass.gh-130693: Add support for
-nolinestop, and-strictlimitsoptions totkinter.Text.search(). Also add thetkinter.Text.search_all()method for-alland-overlapoptions.gh-122255: In the
linecachemodule and in the Python implementation of thewarningsmodule, aDeprecationWarningis issued whenmod.__loader__differs frommod.__spec__.loader(like in the C implementation of thewarningsmodule).gh-121011:
math.log()now supports arbitrary large integer-like arguments in the same way as arbitrary large integer arguments.gh-119668: Publicly expose and document
importlib.machinery.NamespacePath.gh-102431: Clarify constraints for “logical” arguments in methods of
decimal.Context.gh-81313: Add the
math.integermodule (PEP 791).
Core and Builtins¶
gh-141579: Fix
sys.activate_stack_trampoline()to properly support theperf_jitbackend. Patch by Pablo Galindo.gh-114203: Skip locking if object is already locked by two-mutex critical section.
gh-141528: Suggest using
concurrent.interpreters.Interpreter.close()instead of the private_interpreters.destroyfunction when warning about remaining subinterpreters. Patch by Sergey Miryanov.gh-141367: Specialize
CALL_LIST_APPENDinstruction only for lists, not for list subclasses, to avoid unnecessary deopt. Patch by Mikhail Efimov.gh-141312: Fix the assertion failure in the
__setstate__method of the range iterator when a non-integer argument is passed. Patch by Sergey Miryanov.gh-140643: Add support for
<GC>and<native>frames toprofiling.samplingoutput to denote active garbage collection and calls to native code.
Library¶
Core and Builtins¶
gh-140479: Update JIT compilation to use LLVM 21 at build time.
gh-140939: Fix memory leak when
bytearrayorbytesis formated with the%*bformat with a large width that results in aMemoryError.
Library¶
Core and Builtins¶
gh-140530: Fix a reference leak when
raise exc from causefails. Patch by Bénédikt Tran.
Library¶
gh-90344: Replace
io.IncrementalNewlineDecoderwith non incremental newline decoders in codebase whereio.IncrementalNewlineDecoder.decode()was being called once.
Core and Builtins¶
gh-140373: Correctly emit
PY_UNWINDevent when generator object is closed. Patch by Mikhail Efimov.gh-140729: Fix pickling error in the sampling profiler when using
concurrent.futures.ProcessPoolExecutorscript can not be properly pickled and executed in worker processes.gh-131527: Dynamic borrow checking for stackrefs is added to
Py_STACKREF_DEBUGmode. Patch by Mikhail Efimov.gh-140576: Fixed crash in
tokenize.generate_tokens()in case of specific incorrect input. Patch by Mikhail Efimov.gh-140544: Speed up accessing interpreter state by caching it in a thread local variable. Patch by Kumar Aditya.
gh-140551: Fixed crash in
dictifdict.clear()is called at the lookup stage. Patch by Mikhail Efimov and Inada Naoki.gh-140517: Fixed a reference leak when iterating over the result of
map()withstrict=Truewhen the input iterables have different lengths. Patch by Mikhail Efimov.gh-133467: Fix race when updating
type.__bases__that could allow a read oftype.__base__to observe an inconsistent value on the free threaded build.gh-140471: Fix potential buffer overflow in
ast.ASTnode initialization when encountering malformed_fieldscontaining non-str.
Library¶
gh-140443: The logarithm functions (such as
math.log10()andmath.log()) may now produce slightly different results for extremely large integers that cannot be converted to floats without overflow. These results are generally more accurate, with reduced worst-case error and a tighter overall error distribution.
Core and Builtins¶
gh-140431: Fix a crash in Python’s garbage collector due to partially initialized coroutine objects when coroutine origin tracking depth is enabled (
sys.set_coroutine_origin_tracking_depth()).gh-140476: Optimize
PySet_Add()forfrozensetin free threaded build.gh-135904: Add special labels to the assembly created during stencil creation to support relocations that the native object file format does not support. Specifically, 19 bit branches for AArch64 in Mach-O object files.
Library¶
gh-140398: Fix memory leaks in
readlinefunctionsread_init_file(),read_history_file(),write_history_file(), andappend_history_file()whenPySys_Audit()fails.
Core and Builtins¶
gh-140406: Fix memory leak when an object’s
__hash__()method returns an object that isn’t anint.gh-140358: Restore elapsed time and unreachable object count in GC debug output. These were inadvertently removed during a refactor of
gc.c. The debug log now again reports elapsed collection time and the number of unreachable objects. Contributed by Pål Grønås Drange.gh-136895: Update JIT compilation to use LLVM 20 at build time.
gh-139109: A new tracing frontend for the JIT compiler has been implemented. Patch by Ken Jin. Design for CPython by Ken Jin, Mark Shannon and Brandt Bucher.
gh-140306: Fix memory leaks in cross-interpreter channel operations and shared namespace handling.
gh-116738: Make _suggestions module thread-safe on the free threaded build.
gh-140301: Fix memory leak of
PyConfigin subinterpreters.gh-140257: Fix data race between interpreter_clear() and take_gil() on eval_breaker during finalization with daemon threads.
gh-139951: Fixes a regression in GC performance for a growing heap composed mostly of small tuples.
Counts number of actually tracked objects, instead of trackable objects. This ensures that untracking tuples has the desired effect of reducing GC overhead.
Does not track most untrackable tuples during creation. This prevents large numbers of small tuples causing excessive GCs.
gh-140253: Wrong placement of a double-star pattern inside a mapping pattern now throws a specialized syntax error. Contributed by Bartosz Sławecki in gh-140253.
gh-140104: Fix a bug with exception handling in the JIT. Patch by Ken Jin. Bug reported by Daniel Diniz.
gh-140149: Speed up parsing bytes literals concatenation by using PyBytesWriter API and a single memory allocation (about 3x faster).
gh-140061: Fixing the checking of whether an object is uniquely referenced to ensure free-threaded compatibility. Patch by Sergey Miryanov.
gh-140080: Fix hang during finalization when attempting to call
atexithandlers under no memory.gh-139871: Update
bytearrayto use abytesunder the hood as its buffer and addbytearray.take_bytes()to take it out.gh-140067: Fix memory leak in sub-interpreter creation.
gh-139914: Restore support for HP PA-RISC, which has an upwards-growing stack.
gh-139817: Attribute
__qualname__is added totyping.TypeAliasType. Patch by Mikhail Efimov.gh-135801: Many functions related to compiling or parsing Python code, such as
compile(),ast.parse(),symtable.symtable(), andimportlib.abc.InspectLoader.source_to_code()now allow to specify the module name. It is needed to unambiguous filter syntax warnings by module name.gh-139640:
ast.parse()no longer emits syntax warnings forreturn/break/continueinfinally(see PEP 765) – they are only emitted during compilation.gh-139640: Fix swallowing some syntax warnings in different modules if they accidentally have the same message and are emitted from the same line. Fix duplicated warnings in the
finallyblock.gh-139475: Changes in stackref debugging mode when
Py_STACKREF_DEBUGis set. We use the same pattern of refcounting for stackrefs as in production build.gh-139269: Fix undefined behavior when using unaligned store in JIT’s
patch_*functions.gh-138944: Fix
SyntaxErrormessage when invalid syntax appears on the same line as a validimport ... as ...orfrom ... import ... as ...statement. Patch by Brian Schubert.gh-138857: Improve
SyntaxErrormessage forcasekeyword placed outsidematchbody.gh-131253: Support the
--enable-pystatsbuild option for the free-threaded build.gh-136327: Errors when calling functions with invalid values after
*and**now do not include the function name. Patch by Ilia Solin.gh-134786: If
Py_TPFLAGS_MANAGED_DICTandPy_TPFLAGS_MANAGED_WEAKREFare used, thenPy_TPFLAGS_HAVE_GCmust be used as well.
C API¶
gh-141341: On Windows, rename the
COMPILERmacro to_Py_COMPILERto avoid name conflicts. Patch by Victor Stinner.gh-116146: Add a new
PyImport_CreateModuleFromInitfunc()C-API for creating a module from a spec and initfunc. Patch by Itamar Oren.gh-141042: Make qNaN in
PyFloat_Pack2()andPyFloat_Pack4(), if while conversion to a narrower precision floating-point format — the remaining after truncation payload will be zero. Patch by Sergey B Kirpichev.gh-141004:
Py_MATH_ElandPy_MATH_PIlare deprecated.gh-141004: The
Py_INFINITYmacro is soft deprecated.gh-140556: PEP 793: Add a new entry point for C extension modules,
PyModExport_<modulename>.gh-140487: Fix
Py_RETURN_NOTIMPLEMENTEDin limited C API 3.11 and older: don’t treatPy_NotImplementedas immortal. Patch by Victor Stinner.gh-140153: Fix
Py_REFCNT()definition on limited C API 3.11-3.13. Patch by Victor Stinner.gh-139653: Add
PyUnstable_ThreadState_SetStackProtection()andPyUnstable_ThreadState_ResetStackProtection()functions to set the stack protection base address and stack protection size of a Python thread state. Patch by Victor Stinner.
Build¶
gh-140454: When building the JIT, match the jit_stencils filename expectations in Makefile with the generator script. This avoid needless JIT recompilation during
make install.gh-140768: Warn when the WASI SDK version doesn’t match what’s supported.
gh-140513: Generate a clear compilation error when
_Py_TAIL_CALL_INTERPis enabled but eitherpreserve_noneormusttailis not supported.gh-140475: Support WASI SDK 25.
gh-140239: Check
statxavailability only on Linux (including Android).gh-140189: iOS builds were added to CI.
gh-137618:
PYTHON_FOR_REGENnow requires Python 3.10 to Python 3.15. Patch by Adam Turner.
Python 3.15.0 alpha 1¶
Release date: 2025-10-14
macOS¶
gh-115119: Update macOS installer to use libmpdecimal 4.0.1.
gh-124111: Update macOS installer to use Tcl/Tk 9.0.2.
gh-132339: Update macOS installer version of OpenSSL to 3.5.4.
gh-137450: macOS installer shell path management improvements: separate the installer
Shell profile updaterpostinstall script from theUpdate Shell Profile.commandto enable more robust error handling.gh-137134: Update macOS installer to ship with SQLite version 3.50.4.
Windows¶
gh-139810: Installing with
py install 3[.x]-devwill now select final versions as well as prereleases.gh-139573: Updated bundled version of OpenSSL to 3.0.18.
gh-138896: Fix error installing C runtime on non-updated Windows machines
gh-138314: Add
winreg.DeleteTree().gh-137136: Suppress build warnings when build on Windows with
--experimental-jit-interpreter.gh-137134: Update Windows installer to ship with SQLite 3.50.4.
gh-135099: Fix a crash that could occur on Windows when a background thread waits on a
PyMutexwhile the main thread is shutting down the interpreter.gh-130727: Fix a race in internal calls into WMI that can result in an “invalid handle” exception under high load. Patch by Chris Eibl.
gh-76023: Make
os.path.realpath()ignore Windows error 1005 when in non-strict mode.gh-133779: Reverts the change to generate different
pyconfig.hfiles based on compiler settings, as it was frequently causing extension builds to break. In particular, thePy_GIL_DISABLEDpreprocessor variable must now always be defined explicitly when compiling for the experimental free-threaded runtime. Thesysconfig.get_config_var()function can be used to determine whether the current runtime was compiled with that flag or not.gh-133626: Ensures packages are not accidentally bundled into the traditional installer.
gh-133580: Fix
sys.getwindowsversion()failing without setting an exception when called on some WinAPI partitions.gh-133572: Avoid LsaNtStatus to WinError conversion on unsupported WinAPI partitions.
gh-133568: Fix compile error when using a WinAPI partition that doesn’t support the RPC runtime library.
gh-133562: Disable handling of security descriptors by
os.mkdir()with mode0o700on WinAPI partitions that do not support it. This only affects custom builds for specialized targets.gh-133537: Avoid using console I/O in WinAPI partitions that don’t support it
gh-131942: Use the Python-specific
Py_DEBUGmacro rather than_DEBUGin Windows-related C code. Patch by Xuehai Pan.
Tools/Demos¶
gh-139330: SBOM generation tool didn’t cross-check the version and checksum values against the
Modules/expat/refresh.shscript, leading to the values becoming out-of-date during routine updates.gh-132006: XCframeworks now include privacy manifests to satisfy Apple App Store submission requirements.
gh-138171: A script for building an iOS XCframework was added. As part of this change, the top level
iOSfolder has been moved to be a subdirectory of theApplefolder.gh-137873: The iOS test runner has been simplified, resolving some issues that have been observed using the runner in GitHub Actions and Azure Pipelines test environments.
gh-137484: Have
Tools/wasm/wasiput the build Python into a directory named after the build triple instead of “build”.gh-137025: The
wasm_build.pyscript has been removed.Tools/wasm/emscriptenandTools/wasm/wasishould be used instead, as described in the Dev Guide.gh-137248: Add a
--logdiroption toTools/wasm/wasifor specifying where to write log files.gh-137243: Have Tools/wasm/wasi detect a WASI SDK install in /opt when it was directly extracted from a release tarball.
gh-136251: Fixes and usability improvements for
Tools/wasm/emscripten/web_examplegh-135968: Stubs for
stripare now provided as part of an iOS install.gh-135379: The cases generator no longer accepts type annotations on stack items. Conversions to non-default types are now done explicitly in bytecodes.c and optimizer_bytecodes.c. This will simplify code generation for top-of-stack caching and other future features.
gh-134215: REPL import autocomplete only suggests private modules when explicitly specified.
Tests¶
gh-139208: Fix regrtest
--fast-ci --verbose: don’t ignore the--verboseoption anymore. Patch by Victor Stinner.gh-138313: Restore skipped test and add janky workaround to prevent select buildbots from failing with a ResourceWarning.
gh-135966: The iOS testbed now handles the
app_packagesfolder as a site directory.gh-135494: Fix regrtest to support excluding tests from
--pgotests. Patch by Victor Stinner.gh-132815: Fix test__opcode: add
JUMP_BACKWARDto specialization stats.gh-135489: Show verbose output for failing tests during PGO profiling step with –enable-optimizations.
gh-135401: Add a new GitHub CI job to test the
sslmodule with AWS-LC as the backing cryptography and TLS library.gh-135120: Add
test.support.subTests().gh-134567: Expose log formatter to users in TestCase.assertLogs.
unittest.TestCase.assertLogs()will now optionally accept a formatter that will be used to format the strings in output if provided.gh-133744: Fix multiprocessing interrupt test. Add an event to synchronize the parent process with the child process: wait until the child process starts sleeping. Patch by Victor Stinner.
gh-133682: Fixed test case
test.test_annotationlib.TestStringFormat.test_displayswhich ensures proper handling of complex data structures (lists, sets, dictionaries, and tuples) in string annotations.gh-133639: Fix
TestPyReplAutoindent.test_auto_indent_default()doesn’t runinput_code.
Security¶
gh-139700: Check consistency of the zip64 end of central directory record. Support records with “zip64 extensible data” if there are no bytes prepended to the ZIP file.
gh-139400:
xml.parsers.expat: Make sure that parent Expat parsers are only garbage-collected once they are no longer referenced by subparsers created byExternalEntityParserCreate(). Patch by Sebastian Pipping.gh-139283:
sqlite3: correctly handle maximum number of rows to fetch inCursor.fetchmanyand reject negative values forCursor.arraysize. Patch by Bénédikt Tran.gh-136053:
marshal: fix a possible crash when deserializingsliceobjects.gh-135661: Fix parsing start and end tags in
html.parser.HTMLParseraccording to the HTML5 standard.Whitespaces no longer accepted between
</and the tag name. E.g.</ script>does not end the script section.Vertical tabulation (
\v) and non-ASCII whitespaces no longer recognized as whitespaces. The only whitespaces are\t\n\r\fand space.Null character (U+0000) no longer ends the tag name.
Attributes and slashes after the tag name in end tags are now ignored, instead of terminating after the first
>in quoted attribute value. E.g.</script/foo=">"/>.Multiple slashes and whitespaces between the last attribute and closing
>are now ignored in both start and end tags. E.g.<a foo=bar/ //>.Multiple
=between attribute name and value are no longer collapsed. E.g.<a foo==bar>produces attribute “foo” with value “=bar”.
gh-135661: Fix CDATA section parsing in
html.parser.HTMLParseraccording to the HTML5 standard:] ]>and]] >no longer end the CDATA section. Add private method_set_support_cdata()which can be used to specify how to parse<[CDATA[— as a CDATA section in foreign content (SVG or MathML) or as a bogus comment in the HTML namespace.gh-102555: Fix comment parsing in
html.parser.HTMLParseraccording to the HTML5 standard.--!>now ends the comment.-- >no longer ends the comment. Support abnormally ended empty comments<-->and<--->.gh-135462: Fix quadratic complexity in processing specially crafted input in
html.parser.HTMLParser. End-of-file errors are now handled according to the HTML5 specs – comments and declarations are automatically closed, tags are ignored.gh-118350: Fix support of escapable raw text mode (elements “textarea” and “title”) in
html.parser.HTMLParser.gh-135034: Fixes multiple issues that allowed
tarfileextraction filters (filter="data"andfilter="tar") to be bypassed using crafted symlinks and hard links.Addresses CVE 2024-12718, CVE 2025-4138, CVE 2025-4330, and CVE 2025-4517.
gh-133767: Fix use-after-free in the “unicode-escape” decoder with a non-“strict” error handler.
gh-133623: Indicate through
ssl.HAS_PSK_TLS13whether thesslmodule supports “External PSKs” in TLSv1.3, as described in RFC 9258. Patch by Will Childs-Klein.gh-128840: Short-circuit the processing of long IPv6 addresses early in
ipaddressto prevent excessive memory consumption and a minor denial-of-service.
Library¶
gh-139482: Optimize
os.environ.clear()by calling clearenv(3) when this function is available. Patch by Victor Stinner.gh-139958: The
application/tomlmime type is now supported bymimetypes. Patch by Gil Forcada.gh-139823:
ensurepipnow fails with a nicer error message when thezlibmodule is not available.gh-139905: Add suggestion to error message for
typing.Genericsubclasses whencls.__parameters__is missing due to a parent class failing to callsuper().__init_subclass__()in its__init_subclass__.gh-139894: Fix incorrect sharing of current task with the child process while forking in
asyncio. Patch by Kumar Aditya.gh-139845: Fix to not print KeyboardInterrupt twice in default asyncio REPL.
gh-139783: Fix
inspect.getsourcelines()for the case when a decorator is followed by a comment or an empty line.gh-139809: Prevent premature colorization of subparser
proginargparse.ArgumentParser.add_subparsers()to respect color environment variable changes after parser creation.gh-139736: Fix excessive indentation in the default
argparseHelpFormatter. Patch by Alexander Edland.gh-70765:
http.server: fix default handling of HTTP/0.9 requests inBaseHTTPRequestHandler. Previously,BaseHTTPRequestHandler.parse_request()incorrectly waited for headers in the request although those are not supported in HTTP/0.9. Patch by Bénédikt Tran.gh-139322: Fix
os.getlogin()error handling: fix the error number. Patch by Victor Stinner.gh-135953: Add a Gecko format output to the tachyon profiler via
--gecko.gh-139184:
os.forkpty()does now make the returned file descriptor non-inheritable.gh-139391: Fix an issue when, on non-Windows platforms, it was not possible to gracefully exit a
python -m asyncioprocess suspended by Ctrl+Z and later resumed by fg other than with kill.gh-90949: Add
SetBillionLaughsAttackProtectionActivationThreshold()andSetBillionLaughsAttackProtectionMaximumAmplification()to xmlparser objects to tune protections against billion laughs attacks. Patch by Bénédikt Tran.gh-139312: Upgrade bundled libexpat to 2.7.3
gh-139289: Do a real lazy-import on
rlcompleterinpdband restore the existing completer after importingrlcompleter.gh-90949: Add
SetAllocTrackerActivationThreshold()andSetAllocTrackerMaximumAmplification()to xmlparser objects to tune protections against disproportional amounts of dynamic memory usage from within an Expat parser. Patch by Bénédikt Tran.gh-67795: Functions that take timestamp or timeout arguments now accept any real numbers (such as
DecimalandFraction), not only integers or floats, although this does not improve precision.gh-95953: A CSS class,
diff_changed, was added to the changed lines in themake_tableoutput ofdifflib.HtmlDiff. Patch by Katie Gardner.gh-139210: Fix use-after-free when reporting unknown event in
xml.etree.ElementTree.iterparse(). Patch by Ken Jin.gh-138860: Lazy import
rlcompleterinpdbto avoid deadlock in subprocess.gh-112729: Fix crash when calling
concurrent.interpreters.create()when the process is out of memory.gh-126016: Fix an assertion failure when sending
KeyboardInterruptto a Python process running a subinterpreter in a separate thread.gh-118803:
collections.abc.ByteStringhas been removed fromcollections.abc.__all__, andtyping.ByteStringhas been removed fromtyping.__all__. The former has been deprecated since Python 3.12, and the latter has been deprecated since Python 3.9. Both classes are scheduled for removal in Python 3.17.Additionally, the following statements now cause
DeprecationWarnings to be emitted at runtime:from collections.abc import ByteString,from typing import ByteString,import collections.abc; collections.abc.ByteStringandimport typing; typing.ByteString. Both classes already causedDeprecationWarnings to be emitted if they were subclassed or used as the second argument toisinstance()orissubclass(), but they did not previously lead toDeprecationWarnings if they were merely imported or accessed from their respective modules.gh-135729: Fix unraisable exception during finalization when using
concurrent.interpretersin the REPL.gh-139076: Fix a bug in the
pydocmodule that was hiding functions in a Python module if they were implemented in an extension module and the module did not have__all__.gh-139090: Add
os.RWF_DONTCACHEconstant for Linux 6.14+.gh-139065: Fix trailing space before a wrapped long word if the line length is exactly width in
textwrap.gh-139001: Fix race condition in
pathlib.Pathon the internal_raw_pathsfield.gh-138813:
multiprocessing.BaseProcessdefaultskwargstoNoneinstead of a shared dictionary.gh-138998: Update bundled libexpat to 2.7.2
gh-118803: Add back
collections.abc.ByteStringandtyping.ByteString. Both had been removed in prior alpha, beta and release candidates for Python 3.14, but their removal has now been postponed to Python 3.17.gh-130567: Fix possible crash in
locale.strxfrm()due to a platform bug on macOS.gh-137226: Fix
typing.get_type_hints()calls on generictyping.TypedDictclasses defined with string annotations.gh-138899: Executing
quitcommand inpdbwill raisebdb.BdbQuitwhenpdbis started from an asyncio console usingbreakpoint()orpdb.set_trace().gh-138804: Raise
TypeErrorinstead ofAttributeErrorwhen an argument of incorrect type is passed toshlex.quote(). This restores the behavior of the function prior to 3.14.gh-138779: Support device numbers larger than
2**63-1for thest_rdevfield of theos.stat_resultstructure.gh-138682: Added symmetric difference support to
collections.Counterobjects.gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value for mac
gh-138720: Fix an issue where
io.BufferedWriterandio.BufferedRandomhad different definitions of “closed” forclose()andflush()which resulted in an exception when close called flush but flush thought the file was already closed.gh-138706: Update
unicodedatadatabase to Unicode 17.0.0.gh-76007: Deprecate
__version__from a number of standard library modules. Patch by Hugo van Kemenade.gh-138535: Speed up
os.stat()for files with reasonable timestamps. Contributed by Jeffrey Bosboom.gh-116946:
curses.panel: the type ofcurses.panel.new_panel()is now immutable. Patch by Bénédikt Tran.gh-116946:
zlib: the types ofzlib.compressobj()andzlib.decompressobj()are now immutable. Patch by Bénédikt Tran.gh-116946:
os: theos.DirEntrytype and the type ofos.scandir()are now immutable. Patch by Bénédikt Tran.gh-116946:
tkinter: the types_tkinter.Tcl_Obj(wrapper for Tcl objects),_tkinter.tktimertoken(obtained by callingcreatetimerhandler()on aTkapplication) and_tkinter.tkapp(the runtime type of Tk applications) are now immutable. Patch by Bénédikt Tran.gh-138514: Raise
ValueErrorwhen a multi-character string is passed to the echo_char parameter ofgetpass.getpass(). Patch by Benjamin Johnson.gh-137706: Fix the partial evaluation of annotations that use
typing.Annotated[T, x]whereTis a forward reference.gh-88375: Fix normalization of the
robots.txtrules and URLs in theurllib.robotparsermodule. No longer ignore trailing?. Distinguish raw special characters?,=and&from the percent-encoded ones.gh-99948:
ctypes.util.find_library()now works in Emscripten build.gh-111788: Fix parsing errors in the
urllib.robotparsermodule. Don’t fail trying to parse weird paths. Don’t fail trying to decode non-UTF-8robots.txtfiles.gh-138432:
zoneinfo.reset_tzpath()will now convert anyos.PathLikeobjects it receives into strings before adding them toTZPATH. It will raiseTypeErrorif anything other than a string is found after this conversion. If given anos.PathLikeobject that represents a relative path, it will now raiseValueErrorinstead ofTypeError, and present a more informative error message.gh-132657: Improve the scaling of
copy.copy()andcopy.deepcopy()in the free-threading build.gh-116946: The types of
select.poll()andselect.epoll()objects are now immutable. Patch by Bénédikt Tran.gh-116946: The
_random.RandomC type is now immutable. Patch by Bénédikt Tran.gh-57911: When extracting tar files on Windows, slashes in symlink targets will be replaced by backslashes to prevent corrupted links.
gh-138205: Removed the
resize()method on platforms that don’t support the underlying syscall, instead of raising aSystemError.gh-138008: Fix segmentation faults in the
ctypesmodule due to invalidargtypes. Patch by Dung Nguyen.gh-138252:
ssl:SSLContextobjects can now set client and server TLS signature algorithms. If Python has been built with OpenSSL 3.5 or later,SSLSocketobjects can return the signature algorithms selected on a connection.gh-138253: Add the block parameter in the
put()andget()methods of theconcurrent.interpretersqueues for compatibility with thequeue.Queueinterface.gh-60462: Fix
locale.strxfrm()on Solaris (and possibly other platforms).gh-138239: The REPL now highlights
typeas a soft keyword in type statements.gh-78502:
mmap.mmapnow has a trackfd parameter on Windows; if it isFalse, the file handle corresponding to fileno will not be duplicated.gh-138204: Forbid expansion of shared anonymous
memory mapson Linux, which caused a bus error.gh-138010: Fix an issue where defining a class with a
@warnings.deprecated-decorated base class may not invoke the correct__init_subclass__()method in cases involving multiple inheritance. Patch by Brian Schubert.gh-134716: Add support of regular expressions in the
-Woption and thePYTHONWARNINGSenvironment variable.gh-138133: Prevent infinite traceback loop when sending CTRL^C to Python through
strace.gh-138122: Implement PEP 799 – A dedicated profiling package for organizing Python profiling tools. Patch by Pablo Galindo.
gh-138092: Fixed a bug in
mmap.mmap.flush()where calling with only an offset parameter would fail.gh-138044: Remove compatibility shim for deprecated parameter package in
importlib.resources.files(). Patch by Semyon Moroz.gh-137884: Add
threading.get_native_id()support for Illumos/Solaris. Patch by Yüce Tekol.gh-134869: Fix an issue where pressing Ctrl+C during tab completion in the REPL would leave the autocompletion menu in a corrupted state.
gh-137840:
typing.TypedDictnow supports theclosedandextra_itemskeyword arguments (as described in PEP 728) to control whether additional non-required keys are allowed and to specify their value type.gh-132947: Applied changes to
importlib.metadatafrom importlib_metadata 8.7, includingdistnow disallowed forEntryPoints.select; deferred imports for faster import times; added support for metadata with newlines (python/cpython#119650); andmetadata()function now returnsNonewhen a metadata directory is present but no metadata is present.gh-90548: Fix
musldetection forplatform.libc_ver()on Alpine Linux if compiled with –strip-all.gh-137317:
inspect.signature()now correctly handles classes that use a descriptor on a wrapped__init__()or__new__()method. Contributed by Yongyu Yan.gh-137754: Fix import of the
zoneinfomodule if the C implementation of thedatetimemodule is not available.gh-125854: Improve error messages for invalid category in
warnings.warn().gh-137729:
locale.setlocale()now supports language codes with@-modifiers.@-modifier are no longer silently removed inlocale.getlocale(), but included in the language code.gh-73487: Speedup processing arguments (up to 1.5x) in the
decimalmodule methods, that now usingMETH_FASTCALLcalling convention. Patch by Sergey B Kirpichev.gh-137634: Calendar pages generated by the
calendar.HTMLCalendarclass now support dark mode and have been migrated to the HTML5 standard for improved accessibility.gh-137630: The
_interpretersmodule now uses Argument Clinic to parse arguments. Patch by Adam Turner.gh-137583: Fix a deadlock introduced in 3.13.6 when a call to
ssl.SSLSocket.recvwas blocked in one thread, and then another method on the object (such asssl.SSLSocket.send) was subsequently called in another thread.gh-92936: Update regex used by
http.cookies.SimpleCookieto handle values containing double quotes.gh-137426: Remove the code deprecation of
importlib.abc.ResourceLoader. It is documented as deprecated, but left for backwards compatibility with other classes inimportlib.abc.gh-137490: Handle
ECANCELEDin the same way asEINTRinsignal.sigwaitinfo()on NetBSD.gh-137512: Add new constants in the
resourcemodule:RLIMIT_NTHR,RLIMIT_UMTXP,RLIMIT_PIPEBUF,RLIMIT_THREADS,RLIM_SAVED_CUR, andRLIM_SAVED_MAX.gh-137044:
resource.RLIM_INFINITYis now always a positive integer. On all supported platforms, it is larger than any limited resource value, which simplifies comparison of the resource values. Previously, it could be negative, such as -1 or -3, depending on platform.gh-137477: Fix
inspect.getblock(),inspect.getsourcelines()andinspect.getsource()for generator expressions.gh-137481: Calendar uses the lengths of the locale’s weekdays to decide if the width requires abbreviation.
gh-137466: Remove undocumented
glob.glob0()andglob.glob1()functions, which have been deprecated since Python 3.13. Useglob.glob()and pass a directory to its root_dir argument instead.gh-137044: Return large limit values as positive integers instead of negative integers in
resource.getrlimit(). Accept large values and reject negative values (exceptRLIM_INFINITY) for limits inresource.setrlimit().gh-115766: Fix
ipaddress.IPv4Interface.is_unspecified.gh-75989:
tarfile.TarFile.extractall()andtarfile.TarFile.extract()now overwrite symlinks when extracting hardlinks. (Contributed by Alexander Enrique Urieles Nieto in gh-75989.)gh-137017: Fix
threading.Thread.is_aliveto remainTrueuntil the underlying OS thread is fully cleaned up. This avoids false negatives in edge cases involving thread monitoring or prematurethreading.Thread.is_alivecalls.gh-137273: Fix debug assertion failure in
locale.setlocale()on Windows.gh-137191: Fix how type parameters are collected, when
typing.Protocolare specified with explicit parameters. Now,typing.Genericandtyping.Protocolalways dictate the parameter number and parameter ordering of types. Previous behavior was a bug.gh-137282: Fix tab completion and
dir()onconcurrent.futures.gh-137257: Bump the version of pip bundled in ensurepip to version 25.2
gh-137239:
heapq: Updateheapq.__all__with*_maxfunctions.gh-124503:
ast.literal_eval()is 10-20% faster for small inputs.gh-137226: Fix behavior of
annotationlib.ForwardRef.evaluate()when the type_params parameter is passed and the name of a type param is also present in an enclosing scope.gh-137197:
SSLContextobjects can now set TLS 1.3 cipher suites viaset_ciphersuites().gh-81325:
tarfile.TarFilenow accepts a path-like when working on a tar archive. (Contributed by Alexander Enrique Urieles Nieto in gh-81325.)gh-137185: Fix a potential async-signal-safety issue in
faulthandlerwhen printing C stack traces.gh-133951: Remove lib64-lib symlink creation when creating new virtual environments in
venvmodulegh-130522: Fix unraisable
TypeErrorraised during interpreter shutdown in thethreadingmodule.gh-137059: Fix handling of file URLs with a Windows drive letter in the URL authority by
urllib.request.url2pathname(). This fixes a regression in earlier pre-releases of Python 3.14.gh-136980: Remove unused C tracing code in bdb for event type
c_call,c_returnandc_exceptiongh-130577:
tarfilenow validates archives to ensure member offsets are non-negative. (Contributed by Alexander Enrique Urieles Nieto in gh-130577.)gh-136170: Removed the unreleased
zipfile.ZipFile.data_offsetproperty added in 3.14.0a7 as it wasn’t fully clear which behavior it should have in some situations so the result was not always what a user might expect.gh-121237: Support
%:zdirective fordatetime.datetime.strptime(),datetime.time.strptime()andtime.strptime(). Patch by Lucas Esposito and Semyon Moroz.gh-136929: Ensure that hash functions guaranteed to be always available exist as attributes of
hashlibeven if they will not work at runtime due to missing backend implementations. For instance,hashlib.md5will no longer raiseAttributeErrorif OpenSSL is not available and Python has been built without MD5 support. Patch by Bénédikt Tran.gh-124621: pyrepl now works in Emscripten.
gh-136914: Fix retrieval of
doctest.DocTest.linenofor objects decorated withfunctools.cache()orfunctools.cached_property.gh-136912:
hmac.digest()now properly handles large keys and messages by falling back to the pure Python implementation when necessary. Patch by Bénédikt Tran.gh-83424: Allows creating a
ctypes.CDLLwithout name when passing a handle as an argument.gh-135228: When
dataclassesreplaces a class with a slotted dataclass, the original class can now be garbage collected again. Earlier changes in Python 3.14 caused this class to always remain in existence together with the replacement class synthesized bydataclasses.gh-136874: Discard URL query and fragment in
urllib.request.url2pathname().gh-136787:
hashlib: improve exception messages when a hash algorithm is not recognized, blocked by the current security policy or incompatible with the desired operation (for instance, using HMAC with SHAKE). Patch by Bénédikt Tran.gh-131724: In
http.client, a new max_response_headers keyword-only parameter has been added toHTTPConnectionandHTTPSConnectionconstructors. This parameter sets the maximum number of allowed response headers, helping to prevent denial-of-service attacks.gh-135427: With
-Werror, the DeprecationWarning emitted byos.fork()andos.forkpty()in mutli-threaded processes is now raised as an exception. Previously it was silently ignored. Patch by Rani Pinchuk.gh-136234: Fix
asyncio.WriteTransport.writelines()to be robust to connection failure, by using the same behavior aswrite().gh-53144:
encodings.aliases: Addlatin_Naliasesgh-136669:
_asynciois now statically linked for improved performance.gh-136134:
SMTP.auth_cram_md5()now raises anSMTPExceptioninstead of aValueErrorif Python has been built without MD5 support. In particular,SMTPclients will not attempt to use this method even if the remote server is assumed to support it. Patch by Bénédikt Tran.gh-136134:
IMAP4.login_cram_md5now raises anIMAP4.errorif CRAM-MD5 authentication is not supported. Patch by Bénédikt Tran.gh-136591:
_hashlib: avoid using deprecated functions ERR_func_error_string and EVP_MD_CTX_md when using OpenSSL 3.0 and later. Patch by Bénédikt Tran.gh-136571:
datetime.date.fromisocalendar()can now raise OverflowError for out of range arguments.gh-136549: Fix signature of
threading.excepthook().gh-136492: Expose PEP 667’s
FrameLocalsProxyTypein thetypesmodule.gh-83336:
utf8_sigis now aliased toencodings.utf_8_siggh-136523: Fix
wave.Wave_writeemitting an unraisable when open raises.gh-136507: Fix mimetypes CLI to handle multiple file parameters.
gh-52876: Add missing
keepends(defaultTrue) parameter tocodecs.StreamReaderWriter.readline()andcodecs.StreamReaderWriter.readlines().gh-136470: Correct
concurrent.futures.InterpreterPoolExecutor’s default thread name.gh-136476: Fix a bug that was causing the
get_async_stack_tracefunction to miss some frames in the stack trace.gh-136434: Fix docs generation of
UnboundIteminconcurrent.interpreterswhen running with-OO.gh-136380: Raises
AttributeErrorwhen accessingconcurrent.futures.InterpreterPoolExecutorand subinterpreters are not available.gh-72327: Suggest using the system command prompt when
pip installis typed into the REPL. Patch by Tom Viner, Richard Si, and Brian Schubert.gh-135953: Implement a new high-frequency runtime profiler that leverages the existing remote debugging functionality to collect detailed execution statistics from running Python processes. This tool is exposed in the
profile.samplemodule and enables non-intrusive observation of production applications by attaching to already-running processes without requiring any code modifications, restarts, or special startup flags. The observer can perform extremely high-frequency sampling of stack traces and interpreter state, providing detailed runtime execution analysis of live applications.gh-136021: Make
type_paramsparameter required intyping._eval_type()after a deprecation period for not providing this parameter. Also remove theDeprecationWarningfor the old behavior.gh-136286: Fix pickling failures for protocols 0 and 1 for many objects related to subinterpreters.
gh-136047: Fix issues with
typingwhen the C implementation ofabcis not available.gh-136316: Improve support for evaluating nested forward references in
typing.evaluate_forward_ref().gh-136306:
sslcan now get and set groups used for key agreement.gh-136156:
tempfile.TemporaryFile()no longer usesos.O_EXCLwithos.O_TMPFILE, so it’s possible to uselinkat()on the file descriptor. Patch by Victor Stinner.gh-133982: Update Python implementation of
io.BytesIOto be thread safe.gh-136193: Improve
TypeErrorerror message, when richcomparing twotypes.SimpleNamespaceobjects.gh-136097: Fix potential infinite recursion and KeyError in
sysconfig --generate-posix-vars.gh-85702: If
zoneinfo._common.load_tzdatais given a package without a resource azoneinfo.ZoneInfoNotFoundErroris raised rather than aPermissionError. Patch by Victor Stinner.gh-90733: Improve error messages when reporting invalid parameters in
hashlib.scrypt(). Patch by Bénédikt Tran.gh-134759: Fix
UnboundLocalErrorinemail.message.Message.get_payload()when the payload to decode is abytesobject. Patch by Kliment Lamonov.gh-136028: Fix parsing month names containing “İ” (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE) in
time.strptime(). This affects locales az_AZ, ber_DZ, ber_MA and crh_UA.gh-87135: Acquiring a
threading.Lockorthreading.RLockat interpreter shutdown will raisePythonFinalizationErrorif Python can determine that it would otherwise deadlock.gh-135995: In the palmos encoding, make byte
0x9bdecode to›(U+203A - SINGLE RIGHT-POINTING ANGLE QUOTATION MARK).gh-105456: Removed
sre_compile,sre_constantsandsre_parsemodules.gh-53203: Fix
time.strptime()for%cand%xformats on locales byn_ER, wal_ET and lzh_TW, and for%Xformat on locales ar_SA, bg_BG and lzh_TW.gh-135878: Fixes a crash of
types.SimpleNamespaceon free threading builds, when several threads were calling its__repr__()method at the same time.gh-135853: Add
math.fmax()andmath.fmin()to get the larger and smaller of two floating-point values. Patch by Bénédikt Tran.gh-135836: Fix
IndexErrorinasyncio.loop.create_connection()that could occur when non-OSErrorexception is raised during connection and socket’sclose()raisesOSError.gh-135853:
math: expose C99signbit()function to determine whether the sign bit of a floating-point value is set. Patch by Bénédikt Tran.gh-134531:
hmac: use the EVP_MAC(3ssl) interface for HMAC when Python is built with OpenSSL 3.0 and later instead of the deprecated HMAC_CTX(3ssl) interface. Patch by Bénédikt Tran.gh-135836: Fix
IndexErrorinasyncio.loop.create_connection()that could occur when the Happy Eyeballs algorithm resulted in an empty exceptions list during connection attempts.gh-135855: Raise
TypeErrorinstead ofSystemErrorwhen_interpreters.set___main___attrs()is passed a non-dict object. Patch by Brian Schubert.gh-135823:
netrc: improve the error message when the security check for the ownership of the default configuration file~/.netrcfails. Patch by Bénédikt Tran.gh-135815:
netrc: skip security checks ifos.getuid()is missing. Patch by Bénédikt Tran.gh-135640: Address bug where it was possible to call
xml.etree.ElementTree.ElementTree.write()on an ElementTree object with an invalid root element. This behavior blanked the file passed towriteif it already existed.gh-135759:
hashlib: reject negative digest lengths in OpenSSL-based SHAKE objects by raising aValueError. Previously, negative lengths were implicitly rejected by raising aMemoryErroror aSystemError. Patch by Bénédikt Tran.gh-123471: Make concurrent iterations over
itertools.chainsafe under free threading.gh-135645: Added
supports_isolated_interpretersfield tosys.implementation.gh-135646: Raise consistent
NameErrorexceptions inannotationlib.ForwardRef.evaluate()gh-135557: Fix races on
heapqupdates andlistreads on the free threaded build.gh-119180: Only fetch globals and locals if necessary in
annotationlib.get_annotations()gh-135561: Fix a crash on DEBUG builds when an HACL* HMAC routine fails. Patch by Bénédikt Tran.
gh-135386: Fix opening a
dbm.sqlite3database for reading from read-only file or directory.gh-135444: Fix
asyncio.DatagramTransport.sendto()to account for datagram header size when data cannot be sent.gh-65697:
configparser’s error message when attempting to write an invalid key is now more helpful.gh-135497: Fix
os.getlogin()failing for longer usernames on BSD-based platforms.gh-135487: Fix
reprlib.Repr.repr_int()when given integers with more thansys.get_int_max_str_digits()digits. Patch by Bénédikt Tran.gh-135429: Fix the argument mismatch in
_lsprofforPY_THROWevent.gh-135368: Fix
unittest.mock.Mockgeneration ondataclasses.dataclass()objects. Now all special attributes are set as it was before gh-124429.gh-135336:
jsonnow encodes strings up to 2.2x faster if they consist solely of characters that don’t require escaping.gh-135335:
multiprocessing: Flushstdoutandstderrafter preloading modules in theforkserver.gh-126631: Fix
multiprocessingforkserverbug which prevented__main__from being preloaded.gh-133967: Do not normalize
localename ‘C.UTF-8’ to ‘en_US.UTF-8’.gh-130870: Preserve
types.GenericAliassubclasses intyping.get_type_hints()gh-135321: Raise a correct exception for values greater than 0x7fffffff for the
BINSTRINGopcode in the C implementation ofpickle.gh-121914: Changed the names of the symbol tables for lambda expressions and generator expressions to “<lambda>” and “<genexpr>” respectively to avoid conflicts with user-defined names.
gh-135276: Synchronized zipfile.Path with zipp 3.23, including improved performance of
zipfile.Path.open()for non-reading modes, rely onfunctools.cached_property()to cache values on the instance. Rely onsave_method_argsto save the initialization method arguments. Fixed.name,.stemand other basename-based properties on Windows when working with a zipfile on disk.gh-135234:
hashlib: improve exception messages when an OpenSSL function failed. When memory allocation fails on OpenSSL’s side, aMemoryErroris raised instead of aValueError. Patch by Bénédikt Tran.gh-135244:
uuid: when the MAC address cannot be determined, the 48-bit node ID is now generated with a cryptographically-secure pseudo-random number generator (CSPRNG) as per RFC 9562, §6.10.3. This affectsuuid1()anduuid6().gh-135241: The
INTopcode of the C accelerator_picklemodule was updated to look only for “00” and “01” to push booleans onto the stack, aligning with the Pythonpicklemodule.gh-135069: Fix the “Invalid error handling” exception in
encodings.idna.IncrementalDecoderto correctly replace the ‘errors’ parameter.gh-130662: +Accept leading zeros in precision and width fields for +:class:
Decimalformatting, for exampleformat(Decimal(1.25), '.016f').gh-130662: Accept leading zeros in precision and width fields for
Fractionformatting, for exampleformat(Fraction(1, 3), '.016f').gh-135004: Rewrite and cleanup the internal
_blake2module. Some exception messages were changed but their types were left untouched. Patch by Bénédikt Tran.gh-134953: Expand
_colorizetheme withkeyword_constantand implement in repl.gh-134978:
hashlib: Supporting thestringkeyword parameter in hash function constructors such asnew()or the direct hash-named constructors such asmd5()andsha256()is now deprecated and slated for removal in Python 3.19. Prefer passing the initial data as a positional argument for maximum backwards compatibility. Patch by Bénédikt Tran.gh-134970: Fix the “unknown action” exception in
argparse.ArgumentParser.add_argument_group()to correctly replace the action class.gh-134718: By default, omit optional
Load()values inast.dump().gh-134718:
ast.dump()now only omitsNoneand[]values if they are default values.gh-134939: Add the
concurrent.interpretersmodule. See PEP 734.gh-108885: Run each example as a subtest in unit tests synthesized by
doctest.DocFileSuite()anddoctest.DocTestSuite(). Add thedoctest.DocTestRunner.report_skip()method.gh-134885: Fix possible crash in the
compression.zstdmodule related to setting parameter types. Patch by Jelle Zijlstra.gh-134857: Improve error report for
doctests run withunittest. Removedoctestmodule frames from tracebacks and redundant newline character from a failure message.gh-128840: Fix parsing long IPv6 addresses with embedded IPv4 address.
gh-133579:
curses: Consistently report failures of curses C API calls in module-level methods by raising acurses.error. This affectsassume_default_colors(),baudrate(),cbreak(),echo(),longname(),initscr(),nl(),raw(),termattrs(),termname()andunctrl(). Patch by Bénédikt Tran.gh-133579:
curses.window.refresh()andcurses.window.noutrefresh()now raise aTypeErrorinstead ofcurses.errorwhen called with an incorrect number of arguments for pads. Patch by Bénédikt Tran.gh-133579: curses.window: Consistently report failures of curses C API calls in Window methods by raising a
curses.error. This affectsaddch(),addnstr(),addstr(),border(),box(),chgat(),getbkgd(),inch(),insstr()andinsnstr(). Patch by Bénédikt Tran.gh-134771: The
time_clockid_converter()function now selects correct type forclockid_ton Cygwin which fixes a build error.gh-134637: Fix performance regression in calling a
ctypesfunction pointer in free threading.gh-134696: Built-in HACL* and OpenSSL implementations of hash function constructors now correctly accept the same documented named arguments. For instance,
md5()could be previously invoked asmd5(data=data)ormd5(string=string)depending on the underlying implementation but these calls were not compatible. Patch by Bénédikt Tran.gh-132710: If possible, ensure that
uuid.getnode()returns the same result even across different processes. Previously, the result was constant only within the same process. Patch by Bénédikt Tran.gh-134531:
_hashlib: Rename internal C functions for_hashlib.HASHand_hashlib.HASHXOFobjects. Patch by Bénédikt Tran.gh-134698: Fix a crash when calling methods of
ssl.SSLContextorssl.SSLSocketacross multiple threads.gh-134151:
email: FixTypeErrorinemail.utils.decode_params()when sorting RFC 2231 continuations that contain an unnumbered section.gh-134635:
zlib: Allow to combine Adler-32 and CRC-32 checksums viaadler32_combine()andcrc32_combine(). Patch by Callum Attryde and Bénédikt Tran.gh-134657:
asyncio: Remove some private names fromasyncio.__all__.gh-134210:
curses.window.getch()now correctly handles signals. Patch by Bénédikt Tran.gh-80334:
multiprocessing.freeze_support()now checks for work on any “spawn” start method platform rather than only on Windows.gh-134582: Fix tokenize.untokenize() round-trip errors related to t-strings braces escaping
gh-134580: Improved the styling of HTML diff pages generated by the
difflib.HtmlDiffclass, and migrated the output to the HTML5 standard.gh-134565:
unittest.doModuleCleanups()no longer swallows all but first exception raised in the cleanup code, but raises aExceptionGroupif multiple errors occurred.gh-134546: Ensure
pdbremote debugging script is readable by remote Python process.gh-134451: Converted
asyncio.tools.CycleFoundExceptionfrom dataclass to a regular exception type.gh-114177: Fix
asyncioto not close subprocess pipes which would otherwise error out when the event loop is already closed.gh-90871: Fixed an off by one error concerning the backlog parameter in
create_unix_server(). Contributed by Christian Harries.gh-134323: Fix the
threading.RLock.locked()method.gh-86802: Fixed asyncio memory leak in cancelled shield tasks. For shielded tasks where the shield was cancelled, log potential exceptions through the exception handler. Contributed by Christian Harries.
gh-71189: Add support of the all-but-last mode in
os.path.realpath().gh-72902: Improve speed (x1.1-1.8) of the
Fractionconstructor for typical inputs (float’s,Decimal’s or strings).gh-134209:
curses: Thecurses.window.instr()andcurses.window.getstr()methods now allocate their internal buffer on the heap instead of the stack; in addition, the max buffer size is increased from 1023 to 2047.gh-88994: Change
datetime.datetime.now()to half-even rounding for consistency withdatetime.datetime.fromtimestamp(). Patch by John Keith Hohm.gh-80184: The default queue size is now
socket.SOMAXCONNforsocketserver.TCPServer.gh-132983: Add
compression.zstdversion information totest.pythoninfo.gh-134235: Updated tab completion on REPL to include builtin modules. Contributed by Tom Wang, Hunter Young
gh-134152: Fixed
UnboundLocalErrorthat could occur duringemailheader parsing if an expected trailing delimiter is missing in some contexts.gh-134152:
email: Fix parsing of email message ID with invalid domain.gh-134168:
http.server: Fix IPv6 address binding and--directoryhandling when using HTTPS.gh-62184: Remove import of C implementation of
io.FileIOfrom Python implementation which has its own implementationgh-134087: Remove support for arbitrary positional or keyword arguments in the C implementation of
threading.RLockobjects. This was deprecated since Python 3.14. Patch by Bénédikt Tran.gh-134173: Speed up
asyncioperformance of transferring state from thread poolconcurrent.futures.Futureby up to 4.4x. Patch by J. Nick Koston.gh-133982: Emit
RuntimeWarningin the Python implementation ofiowhen the file-like object is not closed explicitly in the presence of multiple I/O layers.gh-133890: The
tarfilemodule now handlesUnicodeEncodeErrorin the same way asOSErrorwhen cannot extract a member.gh-134097: Fix interaction of the new REPL and
-X showrefcountcommand line option.gh-133889: The generated directory listing page in
http.server.SimpleHTTPRequestHandlernow only shows the decoded path component of the requested URL, and not the query and fragment.gh-134098: Fix handling paths that end with a percent-encoded slash (
%2for%2F) inhttp.server.SimpleHTTPRequestHandler.gh-132124: On POSIX-compliant systems,
multiprocessing.util.get_temp_dir()now ignoresTMPDIR(and similar environment variables) if the path length ofAF_UNIXsocket files exceeds the platform-specific maximum length when using the forkserver start method. Patch by Bénédikt Tran.gh-134062:
ipaddress: fix collisions in__hash__()forIPv4NetworkandIPv6Networkobjects.gh-134004:
shelveas well as underlyingdbm.dumbanddbm.sqlitenow havereorganize()methods to recover unused free space previously occupied by deleted entries.gh-133970: Make
string.templatelib.Templateandstring.templatelib.Interpolationgeneric.gh-71253: Raise
ValueErrorinopen()if opener returns a negative file-descriptor in the Python implementation ofioto match the C implementation.gh-133960: Simplify and improve
typing.evaluate_forward_ref(). It now no longer raises errors on certain invalid types. In several situations, it is now able to evaluate forward references that were previously unsupported.gh-133925: Make the private class
typing._UnionGenericAliashashable.gh-133604: Remove
platform.java_ver()which was deprecated since Python 3.13.gh-133875: Removed deprecated
pathlib.PurePath.is_reserved(). Useos.path.isreserved()to detect reserved paths on Windows.gh-133873: Remove the deprecated
getmark(),setmark()andgetmarkers()methods of theWave_readandWave_writeclasses, which were deprecated since Python 3.13. Patch by Bénédikt Tran.gh-133866: Remove the undocumented function
ctypes.SetPointerType(), which has been deprecated since Python 3.13. Patch by Bénédikt Tran.gh-133823: Remove support for
TD = TypedDict("TD")andTD = TypedDict("TD", None)calls for constructingtyping.TypedDictobjects with zero field. Patch by Bénédikt Tran.gh-125996: Fix thread safety of
collections.OrderedDict. Patch by Kumar Aditya.gh-133817: Remove support for creating
NamedTupleclasses via the undocumented keyword argument syntax. Patch by Bénédikt Tran.gh-133653: Fix
argparse.ArgumentParserwith the formatter_class argument. Fix TypeError when formatter_class is a custom subclass ofHelpFormatter. Fix TypeError when formatter_class is not a subclass ofHelpFormatterand non-standard prefix_char is used. Fix support of colorizing when formatter_class is not a subclass ofHelpFormatter.gh-133810: Remove
http.server.CGIHTTPRequestHandlerand--cgiflag from the python -m http.server command-line interface. They were deprecated in Python 3.13. Patch by Bénédikt Tran.gh-132641: Fixed a race in
functools.lru_cache()under free-threading.gh-133783: Fix bug with applying
copy.replace()toastobjects. Attributes that default toNonewere incorrectly treated as required for manually created AST nodes.gh-133684: Fix bug where
annotationlib.get_annotations()would return the wrong result for certain classes that are part of a class hierarchy wherefrom __future__ import annotationsis used.gh-77057: Fix handling of invalid markup declarations in
html.parser.HTMLParser.gh-130328: Speedup pasting in
PyREPLon Windows in a legacy console. Patch by Chris Eibl.gh-133701: Fix bug where
typing.TypedDictclasses defined underfrom __future__ import annotationsand inheriting from anotherTypedDicthad an incorrect__annotations__attribute.gh-133656: Remove deprecated
zipimport.zipimporter.load_module(). Usezipimport.zipimporter.exec_module()instead.gh-133722: Added a color option to
difflib.unified_diff()that colors output similar to git diff.gh-133489:
random.getrandbits()can now generate more that 231 bits.random.randbytes()can now generate more that 256 MiB.gh-133595: Clean up
sqlite3.ConnectionAPIs. All parameters ofsqlite3.connect()except database are now keyword-only. The first three parameters of methodscreate_function()andcreate_aggregate()are now positional-only. The first parameter of methodsset_authorizer(),set_progress_handler()andset_trace_callback()is now positional-only.gh-133581: Improve unparsing of t-strings in
ast.unparse()andfrom __future__ import annotations. Empty t-strings now round-trip correctly and formatting in interpolations is preserved. Patch by Jelle Zijlstra.gh-133577: Add parameter
formattertologging.basicConfig().gh-92897: Removed the
check_homeparameter fromsysconfig.is_python_build(), deprecated since Python 3.12.gh-133551: Support t-strings (PEP 750) in
annotationlib. Patch by Jelle Zijlstra.gh-133517: Remove
os.listdrives(),os.listvolumes()andos.listmounts()in non Windows desktop builds since the underlying functionality is missing.gh-133439: Fix dot commands with trailing spaces are mistaken for multi-line SQL statements in the sqlite3 command-line interface.
gh-133390: Support keyword completion in the
sqlite3command-line interface and addsqlite3.SQLITE_KEYWORDSconstant.gh-132493: Avoid accessing
__annotations__unnecessarily ininspect.signature().gh-133017: Improve the error message of
multiprocessing.sharedctypes.Array(),multiprocessing.sharedctypes.RawArray(),multiprocessing.sharedctypes.Value()andmultiprocessing.sharedctypes.RawValue()when an invalid typecode is passed. Patch by Tomas Roungh-132813: Improve error messages for incorrect types and values of
csv.Dialectattributes.gh-132969: Prevent the
ProcessPoolExecutorexecutor thread, which remains running whenshutdown(wait=False), from attempting to adjust the pool’s worker processes after the object state has already been reset during shutdown. A combination of conditions, including a worker process having terminated abormally, resulted in an exception and a potential hang when the still-running executor thread attempted to replace dead workers within the pool.gh-132876:
ldexp()on Windows doesn’t round subnormal results before Windows 11, but should. Python’smath.ldexp()wrapper now does round them, so results may change slightly, in rare cases of very small results, on Windows versions before 11.gh-133009:
xml.etree.ElementTree: Fix a crash inElement.__deepcopy__when the element is concurrently mutated. Patch by Bénédikt Tran.gh-132908: Add
math.isnormal()andmath.issubnormal()functions. Patch by Sergey B Kirpichev.gh-95380:
fcntl.fcntl()andfcntl.ioctl(): Remove the 1024 bytes limit on the size of not mutated bytes-like argument.gh-122781: Fix
%zdirective indatetime.datetime.strptime()to allow for no provided offset as was documented.gh-123471: Make concurrent iterations over
itertools.combinationsanditertools.productsafe under free-threading.gh-127081: Fix libc thread safety issues with
dbmby performing stateful operations in critical sections.gh-127081: Fix libc thread safety issues with
osby replacinggetloginwithgetlogin_rre-entrant version.gh-127081: Fix libc thread safety issues with
pwdby locking access togetpwall.gh-132551: Make
io.BytesIOsafe in free-threaded build.gh-107583: Fix
Flaginversion when flag set has missing values (IntFlagstill flips all bits); fix negative assigned values during flag creation (bothFlagandIntFlagignore missing values).gh-87790: Support underscore and comma as thousands separators in the fractional part for
Fraction’s formatting. Patch by Sergey B Kirpichev.gh-87790: Support underscore and comma as thousands separators in the fractional part for
Decimal’s formatting. Patch by Sergey B Kirpichev.gh-131884: Fix formatting issues in
json.dump()when both indent and skipkeys are used.gh-131788: Make
ResourceTracker.sendfrommultiprocessingre-entrant safegh-91349: Adjust default
compressionlevel=to 6 (down from 9) ingzipandtarfile. It is the default level used by most compression tools and a better tradeoff between speed and performance.gh-131146: Fix
calendar.TextCalendar,calendar.HTMLCalendar, and thecalendarCLI to display month names in the nominative case by addingcalendar.standalone_month_nameandcalendar.standalone_month_abbr, which provide month names and abbreviations in the grammatical form used when a month name stands by itself, if the locale supports it.gh-123471: Make concurrent iterations over
itertools.cyclesafe under free-threading.gh-130664: Handle corner-case for
Fraction’s formatting: treat zero-padding (preceding the width field by a zero ('0') character) as an equivalent to a fill character of'0'with an alignment type of'=', just as in case offloat’s.gh-130999: Avoid exiting the new REPL and offer suggestions even if there are non-string candidates when errors occur.
gh-88473: Implement a fast path for
datetime.dateobjects indatetime.date.today()which results in a 5x performance gain while proper subclasses retain their previous performance.gh-126883: Add check that timezone fields are in range for
datetime.datetime.fromisoformat()anddatetime.time.fromisoformat(). Patch by Semyon Moroz.gh-125028:
functools.Placeholdercannot be passed tofunctools.partial()as a keyword argument.gh-125843: If possible, indicate which
cursesC function or macro is responsible for raising acurses.errorexception. Patch by Bénédikt Tran.gh-119109:
functools.partial()calls are now faster when keyword arguments are used.gh-124033:
SimplePathis now presented inimportlib.metadata.__all__.gh-91216:
importlib.metadatanow raises aKeyErrorinstead of returningNonewhen a key is missing from the metadata.gh-120492:
importlib.metadatanow prioritizes valid dists to invalid dists when retrieving by name.gh-99631: The
shelvemodule now accepts custom serialization and deserialization functions.gh-119186: Slightly speed up
os.walk()by callingos.path.join()less often.gh-120170: Fix an issue in the
_pickleextension module in which importingmultiprocessingcould change how pickle identifies which module an object belongs to, potentially breaking the unpickling of those objects.gh-118981: Fix potential hang in
multiprocessing.popen_spawn_posixthat can happen when the child proc dies early by closing the child fds right away.gh-105497: Fix flag mask inversion when unnamed flags exist.
gh-99813:
sslnow usesSSL_sendfileinternally when it is possible (seeOP_ENABLE_KTLS). The function sends a file more efficiently because it performs TLS encryption in the kernel to avoid additional context switches. Patch by Illia Volochii.gh-62824: Fix aliases for
iso8859_8encoding. Patch by Dave Goncalves.gh-86155:
html.parser.HTMLParser.close()no longer loses data when the<script>tag is not closed. Patch by Waylan Limberg.gh-78319: UTF8 support for the IMAP APPEND command has been made RFC compliant.
gh-93334: Reraise
KeyErrorasModuleNotFoundErrorwhenimportlib.machinery.PathFinder.find_spec()is called on a submodule without importing the parent (and without apathargument).gh-69426: Fix
html.parser.HTMLParserto not unescape character entities in attribute values if they are followed by an ASCII alphanumeric or an equals sign.bpo-38735: Fix failure when importing a module from the root directory on unix-like platforms with sys.pycache_prefix set.
gh-84683:
zoneinfo: Check in<prefix>/share/zoneinfofor data files on Windowsbpo-43429: The
size()method of themmap.mmapclass now returns the size of an anonymous mapping on both Unix and Windows. Previously, the size would be returned on Windows and anOSErrorwould be raised on Unix.ValueErroris now raised instead ofOSErrorwhentrackfd=False.bpo-41839: Allow negative priority values from
os.sched_get_priority_min()andos.sched_get_priority_max()functions.bpo-28494: Improve Zip file validation false positive rate in
zipfile.is_zipfile().
IDLE¶
Documentation¶
Core and Builtins¶
gh-140000: Fix potential memory leak when a reference cycle exists between an instance of
typing.TypeAliasType,typing.TypeVar,typing.ParamSpec, ortyping.TypeVarTupleand its__name__attribute. Patch by Mikhail Efimov.gh-140009: Improve performance of list extension by dictionary items.
gh-139988: Fix a memory leak when failing to create a
Uniontype. Patch by Bénédikt Tran.gh-139748: Fix reference leaks in error branches of functions accepting path strings or bytes such as
compile()andos.system(). Patch by Bénédikt Tran.gh-139516: Fix lambda colon erroneously start format spec in f-string in tokenizer.
gh-63161: Support non-UTF-8 shebang and comments in Python source files if non-UTF-8 encoding is specified. Detect decoding error in comments for default (UTF-8) encoding. Show the line and position of decoding error for default encoding in a traceback. Show the line containing the coding cookie when it conflicts with the BOM in a traceback.
gh-139116: Prevent a deadlock when multiple threads start, stop and use
tracemallocsimultaneously.gh-139275: Fix compilation problems in
_remote_debugging_module.cwhen the system doesn’t haveprocess_vm_readv. Patch by Pablo Galindogh-133059: Increased the number of cached small positive integers from 256 to 1024.
gh-74857: PEP 538: Coerce the POSIX locale to a UTF-8 based locale. Patch by Victor Stinner.
Library¶
gh-116738: Make
mmapthread-safe on the free threaded build.
Core and Builtins¶
gh-138558: Fix handling of unusual t-string annotations in annotationlib. Patch by Dave Peck.
gh-134466: Don’t run PyREPL in a degraded environment where setting termios attributes is not allowed.
gh-138794: When a new tracing function is registered with
PyRefTracer_SetTracer(), replacing the current a call to the trace function will be made with the object set to NULL and event set toPyRefTracer_TRACKER_REMOVED. This will happen just before the new function is registered. Patch by Pablo Galindogh-71810: Raise
OverflowErrorfor(-1).to_bytes()for signed conversions when bytes count is zero. Patch by Sergey B Kirpichev.gh-138716: Improve
SyntaxErrormessage forassertin cases likeassert a := b.gh-105487: Remove non-existent
__copy__(),__deepcopy__(), and__bases__from the__dir__()entries oftypes.GenericAlias.gh-138192: Fix
contextvarsinitialization so that all subinterpreters are assigned theMISSINGvalue.gh-138479: Fix a crash when a generic object’s
__typing_subst__returns an object that isn’t atuple.gh-138431: Fix a bug in the JIT optimizer when round-tripping strings and tuples.
gh-138378: Move the globals-to-const JIT optimizer pass into to the main JIT optimizer pass
Library¶
gh-138401: Add missing validation of argument
countinos.sendfile()to be non-negative.
Core and Builtins¶
gh-138372: Fix
SyntaxWarningemitted for erroneous subscript expressions involving template string literals. Patch by Brian Schubert.gh-138302:
BINARY_OPnow specializes toBINARY_OP_ADD_INT,BINARY_OP_SUBTRACT_INTorBINARY_OP_MULTIPLY_INTif operands are compact ints.gh-138318: The default REPL now avoids highlighting built-in names (for instance
setorformat()) when they are used as attribute names (for instance invalue.setortext.format).gh-138349: Fix crash in certain cases where a module contains both a module-level annotation and a comprehension.
gh-69605: Fix some standard library submodules missing from the REPL auto-completion of imports.
gh-61206:
zipimportnow supports zstandard compressed zip file entries.
Library¶
gh-116738: Make
cProfilethread-safe on the free threaded build.
Core and Builtins¶
gh-137838: Fix JIT trace buffer overrun by increasing possible exit stubs. Patch by Donghee Na.
gh-71679: Use the same quoting algorithm for the repr of bytearrays as for bytes objects and strings – use double quotes for quoting if the bytearray contains single quotes and does not contain double quotes.
gh-137384: Fix a crash when using the
warningsmodule in a finalizer at shutdown. Patch by Kumar Aditya.
Library¶
Core and Builtins¶
gh-137992: Ensure that
PyRefTracer_SetTracer()sync with all existing threads when called to avoid races in the free threaded build. Patch by Pablo Galindogh-137967: Show error suggestions on nested attribute access. Patch by Pablo Galindo
gh-137959: Replace the shim code added to every piece of jitted code with a single trampoline function.
gh-137883: Fix runaway recursion when calling a function with keyword arguments.
gh-137079: Fix keyword typo recognition when parsing files. Patch by Pablo Galindo.
gh-137728: Fix the JIT’s handling of many local variables. This previously caused a segfault.
gh-137716: Fix double period in
AttributeErrormessage for invalid mock assertionsgh-137433: Fix a potential deadlock in the free threading build when daemon threads enable or disable profiling or tracing while the main thread is shutting down the interpreter.
gh-137576: Fix for incorrect source code being shown in tracebacks from the Basic REPL when
PYTHONSTARTUPis given. Patch by Adam Hartz.gh-37817: Allow assignment to
__bases__of direct subclasses of builtin classes.gh-132732: Optimize
_COMPARE_OP,_CONTAINS_OP,_UNARY_NEGATIVE,_UNARY_NOT, and_UNARY_INVERTin JIT builds with constant-loading uops (_POP_TWO_LOAD_CONST_INLINE_BORROWand_POP_TOP_LOAD_CONST_INLINE_BORROW), and then remove both to reduce instruction count.gh-137400: Fix a crash in the free threading build when disabling profiling or tracing across all threads with
PyEval_SetProfileAllThreads()orPyEval_SetTraceAllThreads()or their Python equivalentsthreading.settrace_all_threads()andthreading.setprofile_all_threads().gh-133143: Add
sys.abi_infoobject to make ABI information more easily accessible.gh-137400: Fix a crash in the free threading build when disabling profiling or tracing across all threads with
PyEval_SetProfileAllThreads()orPyEval_SetTraceAllThreads()or their Python equivalentsthreading.settrace_all_threads()andthreading.setprofile_all_threads().gh-120037: Disable user site packages directory when a
._pthfile is used, even if it containsimport site.gh-58124: Fix name of the Python encoding in Unicode errors of the code page codec: use “cp65000” and “cp65001” instead of “CP_UTF7” and “CP_UTF8” which are not valid Python code names. Patch by Victor Stinner.
gh-136966: The
object.__dict__and__weakref__descriptors now use a single descriptor instance per interpreter, shared across all types that need them. This speeds up class creation, and helps avoid reference cycles.gh-137314: Fixed a regression where raw f-strings incorrectly interpreted escape sequences in format specifications. Raw f-strings now properly preserve literal backslashes in format specs, matching the behavior from Python 3.11. For example,
rf"{obj:\xFF}"now correctly produces'\\xFF'instead of'ÿ'. Patch by Pablo Galindo.gh-137308: A standalone docstring in a node body is optimized as a
passstatement to ensure that the node’s body is never empty. There was aValueErrorincompile()otherwise.gh-137288: Fix bug where some bytecode instructions of a boolean expression are not associated with the correct exception handler.
gh-137291: The perf profiler can now be used if a previous frame evaluation API has been provided.
gh-134291: Remove some newer macOS API usage from the JIT compiler in order to restore compatibility with older OSX 10.15 deployment targets.
gh-88886: The codecs lookup function now again performs only minimal normalization of the encoding name before passing it to the search functions: all ASCII letters are converted to lower case, spaces are replaced with hyphens. This restores the pre-Python 3.9 behavior.
gh-131338: Disable computed stack limit checks on non-glibc linux platforms to fix crashes on deep recursion.
gh-136870: Fix data races while de-instrumenting bytecode of code objects running concurrently in threads.
gh-132732: Optimize constant comparison for
_COMPARE_OP_INT,_COMPARE_OP_FLOATand_COMPARE_OP_STRin JIT buildsgh-127598: Improve
ModuleNotFoundErrorby adding flavour text to the exception when the-Soption is passed. Patch by Andrea Mattei.gh-136801: Fix PyREPL syntax highlighting on match cases after multi-line case. Contributed by Olga Matoula.
gh-74185: The
__repr__()ofImportErrorandModuleNotFoundErrornow shows “name” and “path” asname=<name>andpath=<path>if they were given as keyword arguments at construction time. Patch by Serhiy Storchaka, Oleg Iarygin, and Yoav Nir
Library¶
gh-116738: Make functions in
syslogthread-safe on the free threaded build.gh-116738: Make functions in
pwdthread-safe on the free threaded build.
Core and Builtins¶
gh-136616: Improve
SyntaxErrorerror messages for invalidassertusages.
Library¶
Core and Builtins¶
gh-136541: Fix some issues with the perf trampolines on x86-64 and aarch64. The trampolines were not being generated correctly for some cases, which could lead to the perf integration not working correctly. Patch by Pablo Galindo.
Library¶
gh-107545: Improve the error messages that may be raised by
setsockopt().
Core and Builtins¶
gh-136517: Fixed a typo that prevented printing of uncollectable objects when the
gc.DEBUG_UNCOLLECTABLEmode was set.gh-136525: Fix issue where per-thread bytecode was not instrumented for newly created threads.
gh-132657: Improve performance of
frozensetby removing locks in the free-threading build.gh-136459: Add support for perf trampoline on macOS, to allow profilers wit JIT map support to read Python calls. While profiling,
PYTHONPERFSUPPORT=1can be appended to enable the trampoline.gh-132661:
Interpolation.expressionnow has a default, the empty string.gh-132661: Reflect recent PEP 750 change.
Disallow concatenation of
string.templatelib.Templateandstr. Also, disallow implicit concatenation of t-string literals with string or f-string literals.gh-91636: While performing garbage collection, clear weakrefs to unreachable objects that are created during running of finalizers. If those weakrefs were are not cleared, they could reveal unreachable objects.
gh-136355: Deprecate
-band-bbcommand line options and schedule them to become no-op in Python 3.17.gh-109700: Fix memory error handling in
PyDict_SetDefault().gh-135552: Fix a bug caused by the garbage collector clearing weakrefs too early. The weakrefs in the
tp_subclassesdictionary are needed in order to correctly invalidate type caches (for example, by callingPyType_Modified()). Clearing weakrefs before calling finalizers causes the caches to not be correctly invalidated. That can cause crashes since the caches can refer to invalid objects. Defer the clearing of weakrefs without callbacks until after finalizers are executed.gh-136203: Improve
TypeErrorerror message, when richcomparing twotypes.MappingProxyTypeobjects.gh-136003: Fix
threading.Threadobjects becoming incorrectly daemon when created from anatexitcallback or a pending call (Py_AddPendingCall()).gh-78465: Fix error message for
cls.__new__(cls, ...)whereclsis not instantiable builtin or extension type (withtp_newset toNULL).gh-135904: Perform more aggressive control-flow optimizations on the machine code templates emitted by the experimental JIT compiler.
gh-129958: Differentiate between t-strings and f-strings in syntax error for newlines in format specifiers of single-quoted interpolated strings.
gh-135871: Non-blocking mutex lock attempts now return immediately when the lock is busy instead of briefly spinning in the free threading build.
gh-134584: Specialize
POP_TOPin the JIT compiler by specializing for reference lifetime and type. This will also enable easier top of stack caching in the JIT compiler.gh-135106: Restrict the trashcan mechanism to GC’ed objects and untrack them while in the trashcan to prevent the GC and trashcan mechanisms conflicting.
gh-135379: Changes specialization of
BINARY_OPfor ints to only specialize for “compact” ints. This streamlines the fast path at the cost of fewer specializations when very large integers are used.gh-135607: Fix potential
weakrefraces in an object’s destructor on the free threaded build.gh-135608: Fix a crash in the JIT involving attributes of modules.
gh-82088: Improve performance of
PyLongObjectconversion functionsPyLong_AsLongAndOverflow(),PyLong_AsSsize_t(),PyLong_AsUnsignedLong(),PyLong_AsSize_t(),PyLong_AsUnsignedLongMask(),PyLong_AsUnsignedLongLongMask(),PyLong_AsLongLongAndOverflow()for integers larger than 2**30 up to 30%.gh-135551: Sorting randomly ordered lists will often run a bit faster, thanks to a new scheme for picking minimum run lengths from Stefan Pochmann, which arranges for the merge tree to be as evenly balanced as is possible.
gh-135543: Emit
sys.remote_execaudit event whensys.remote_exec()is called and migrateremote_debugger_scripttocpython.remote_debugger_script.gh-135496: Fix typo in the f-string conversion type error (“exclamanation” -> “exclamation”).
gh-135474: Specialize integer operations only on compact integers. This is a CPython internal change.
gh-135371: Fixed
asynciodebugging tools to properly display internal coroutine call stacks alongside external task dependencies. Thepython -m asyncio psandpython -m asyncio pstreecommands now show complete execution context. Patch by Pablo Galindo.gh-135422: Fix regression in
SyntaxErrormessages after gh-134036.
Library¶
gh-116738: Make functions in
grpthread-safe on the free threaded build.gh-127319: Set the
allow_reuse_portclass variable toFalseon the XMLRPC, logging, and HTTP servers. This matches the behavior in prior Python releases, which is to not allow port reuse.
Core and Builtins¶
gh-130077: Properly raise custom syntax errors when incorrect syntax containing names that are prefixes of soft keywords is encountered. Patch by Pablo Galindo.
gh-131798: Optimize _CALL_LEN in the JIT when the length is known. Patch by Tomas Roun
gh-131798: Optimize
_UNARY_NEGATIVEin JIT-compiled code.gh-135148: Fixed a bug where f-string debug expressions (using =) would incorrectly strip out parts of strings containing escaped quotes and # characters. Patch by Pablo Galindo.
gh-131798: Optimize
_UNARY_INVERTin JIT-compiled code.gh-131798: Optimize away
_CALL_TYPE_1in the JIT when the return type is known. Patch by Tomas Roungh-133136: Limit excess memory usage in the free threading build when a large dictionary or list is resized and accessed by multiple threads.
gh-131798: Optimize
_CHECK_METHOD_VERSIONinto_CHECK_FUNCTION_VERSION_INLINEin JIT-compiled code.
Library¶
gh-116738: Make methods in
heapqthread-safe on the free threaded build.
Core and Builtins¶
gh-134280: Disable constant folding for
~with a boolean argument. This moves the deprecation warning from compile time to runtime.gh-134876: Add support to PEP 768 remote debugging for Linux kernels which don’t have CONFIG_CROSS_MEMORY_ATTACH configured.
gh-134889: Fix handling of a few opcodes that leave operands on the stack when optimizing
LOAD_FAST.
Library¶
gh-134908: Fix crash when iterating over lines in a text file on the free threaded build.
Core and Builtins¶
gh-132617: Fix
dict.update()modification check that could incorrectly raise a “dict mutated during update” error when a different dictionary was modified that happens to share the same underlying keys object.gh-131798: Allow the JIT to remove unnecessary
_ITER_CHECK_TUPLEops.gh-134679: Fix crash in the free threading build’s QSBR code that could occur when changing an object’s
__dict__attribute.gh-133912: Fix the C API function
PyObject_GenericSetDictto handle extension classes with inline values.gh-131798: Make the JIT optimizer understand that slicing a string/list/tuple returns the same type.
gh-134584: Add a reference count elimination pass to the JIT compiler. Patch by Ken Jin.
gh-131798: Optimize
_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW.
Library¶
gh-134381: Fix
RuntimeErrorwhen using a not-startedthreading.Threadafter callingos.fork()
Core and Builtins¶
gh-127960: PyREPL interactive shell no longer starts with
__package__and__file__global names set to_pyreplpackage internals. Contributed by Yuichiro Tachibana.gh-130397: Remove special-casing for C stack depth limits for WASI. Due to WebAssembly’s built-in stack protection this does not pose a security concern.
gh-131798: JIT: replace
_LOAD_SMALL_INTwith_LOAD_CONST_INLINE_BORROWgh-131798: Improve the JIT’s ability to optimize away cached class attribute and method loads.
gh-128066: Fixes an edge case where PyREPL improperly threw an error when Python is invoked on a read only filesystem while trying to write history file entries.
gh-131798: Improve the JIT’s ability to narrow unknown classes to constant values.
gh-134268: Add
_POP_CALL_TWO_LOAD_CONST_INLINE_BORROWand use it to further optimizeCALL_ISINSTANCE.gh-131798: Split
CALL_LIST_APPENDinto several uops. Patch by Diego Russo.gh-69605: When auto-completing an import in the REPL, finding no candidates now issues no suggestion, rather than suggestions from the current namespace.
gh-134170: Add colorization to
sys.unraisablehook()by default.gh-91153: Fix a crash when a
bytearrayis concurrently mutated during item assignment.gh-134158: Fix coloring of double braces in f-strings and t-strings in the REPL.
gh-134119: Fix crash when calling
next()on an exhausted template string iterator. Patch by Jelle Zijlstra.gh-134100: Fix a use-after-free bug that occurs when an imported module isn’t in
sys.modulesafter its initial import. Patch by Nico-Posada.gh-134036: Improve
SyntaxErrormessage when using invalidraisestatements.gh-133999: Fix
SyntaxErrorregression inexceptparsing after gh-123440.gh-133886: Fix
sys.remote_exec()for non-ASCII paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales.gh-133400: Fixed Ctrl+D (^D) behavior in _pyrepl module to match old pre-3.13 REPL behavior.
gh-133703: Fix hashtable in dict can be bigger than intended in some situations.
gh-133778: Fix bug where assigning to the
__annotations__attributes of classes defined underfrom __future__ import annotationshad no effect.gh-133711: Implement PEP 686: Enable Python UTF-8 Mode by default. Patch by Adam Turner.
gh-132762:
fromkeys()no longer loops forever when adding a small set of keys to a large base dict. Patch by Angela Liss.gh-133541: Inconsistent indentation in user input crashed the new REPL when syntax highlighting was active. This is now fixed.
gh-133516: Raise
ValueErrorwhen constantsTrue,FalseorNoneare used as an identifier after NFKC normalization.gh-131798: Allow the JIT to remove int guards after
_GET_LENby setting the return type to int.gh-131798: Split
CALL_ISINSTANCEinto several uops, allowing the JIT to remove some of them.gh-132554: Change iteration to use “virtual iterators” for sequences. Instead of creating an iterator, a tagged integer representing the next index is pushed to the stack above the iterable. For non-sequence iterators,
NULLis pushed.gh-130821: Enhance wrong type error messages and make them more consistent. Patch by Semyon Moroz.
gh-131798: Narrow the return type and constant-evaluate
CALL_ISINSTANCEfor a subset of known values in the JIT. Patch by Tomas Roungh-132542: Update
Thread.native_idafter fork(2) to ensure accuracy. Patch by Noam Cohen.
Library¶
gh-132732: Automatically constant evaluate bytecode operations marked as pure in the JIT optimizer.
Core and Builtins¶
gh-127971: Fix off-by-one read beyond the end of a string in string search.
gh-132042: Improve class creation times by up to 12% by pre-computing type slots just once. Patch by Sergey Miryanov.
gh-133379: Correct usage of arguments in error messages.
gh-127266: In the free-threaded build, avoid data races caused by updating type slots or type flags after the type was initially created. For those (typically rare) cases, use the stop-the-world mechanism. Remove the use of atomics when reading or writing type flags. The use of atomics is not sufficient to avoid races (since flags are sometimes read without a lock and without atomics) and are no longer required.
gh-130425: Add
"Did you mean: 'attr'?"suggestion when usingdel obj.attrifattrdoes not exist.gh-128640: Fix a crash when using threads inside of a subinterpreter.
Library¶
Core and Builtins¶
gh-119494: Exception text when trying to delete attributes of types was clarified.
C API¶
gh-139924: Function watchers can now receive a PyFunction_PYFUNC_EVENT_MODIFY_QUALNAME event when a watched functions qualname is changed.
gh-111489: Add
PyTuple_FromArray()to create atuplefrom an array. Patch by Victor Stinner.gh-136355: Deprecate
PyConfig.bytes_warningfield and schedule its removal in 3.17.gh-138886: Remove deprecated
PySys_ResetWarnOptions()C-API function.gh-129813: Implement PEP 782, the
PyBytesWriterAPI. Add functions:Patch by Victor Stinner.
gh-137956: Display and raise an exception if an extension compiled for non-free-threaded Python is loaded in a free-threaded interpreter.
gh-137573: Mark
_PyOptimizer_OptimizeasPy_NO_INLINEto prevent stack overflow crashes on macOS.gh-128813: Functions
_Py_c_sum(),_Py_c_diff(),_Py_c_neg(),_Py_c_prod(),_Py_c_quot(),_Py_c_pow()and previously undocumented_Py_c_abs()are soft deprecated. Deprecate alsocvalfield of thePyComplexObjecttype. Patch by Sergey B Kirpichev.gh-137210: Add API for checking an extension module’s ABI compatibility:
Py_mod_abi,PyABIInfo_Check(),PyABIInfo_VARandPy_mod_abi.gh-136759: Rename
lock.htopylock.hto avoid potential include conflicts.gh-112068: Revert support of nullable arguments in
PyArg_Parse().gh-136006: On Solaris, the
Py_NANmacro now expands to adoubleinstead of a function address. Patch by Bénédikt Tran.gh-135075: Make
PyObject_SetAttr()andPyObject_SetAttrString()fail if called withNULLvalue and an exception set. Patch by Victor Stinner.gh-135906: Fix compilation errors when compiling the internal headers with a C++ compiler.
gh-133296: New variants for the critical section API that accept one or two
PyMutexpointers rather thanPyObjectinstances are now public in the non-limited C API.gh-133157: Remove the private, undocumented macro
_Py_NO_SANITIZE_UNDEFINED.gh-134989: Fix
Py_RETURN_NONE,Py_RETURN_TRUEandPy_RETURN_FALSEmacros in the limited C API 3.11 and older: don’t treatPy_None,Py_TrueandPy_Falseas immortal. Patch by Victor Stinner.gh-134989: Implement
PyObject_DelAttr()andPyObject_DelAttrString()as macros in the limited C API 3.12 and older. Patch by Victor Stinner.gh-134745: Change
PyThread_allocate_lock()implementation toPyMutex. On Windows,PyThread_acquire_lock_timed()now supports the intr_flag parameter: it can be interrupted. Patch by Victor Stinner.gh-134891: Add
PyUnstable_Unicode_GET_CACHED_HASHto get the cached hash of a string.gh-134009: Expose
PyMutex_IsLocked()as part of the public C API.gh-134144: Fix crash when calling
Py_EndInterpreter()with a thread state that isn’t the initial thread for the interpreter.gh-133968: Add
PyUnicodeWriter_WriteASCII()function to write an ASCII string into aPyUnicodeWriter. The function is faster thanPyUnicodeWriter_WriteUTF8(), but has an undefined behavior if the input string contains non-ASCII characters. Patch by Victor Stinner.gh-133644: Remove deprecated Python initialization getter functions
Py_Get*. Patch by Bénédikt Tran.gh-133644: Remove deprecated function
PyWeakref_GetObject()and macroPyWeakref_GET_OBJECT. UsePyWeakref_GetRef()instead. Patch by Bénédikt Tran.gh-133644: Remove deprecated alias
PyImport_ImportModuleNoBlock()ofPyImport_ImportModule(). Patch by Bénédikt Tran.gh-133610: Remove deprecated functions
PyUnicode_AsDecodedObject(),PyUnicode_AsDecodedUnicode(),PyUnicode_AsEncodedObject(), andPyUnicode_AsEncodedUnicode().gh-132629: For unsigned integer formats in
PyArg_ParseTuple(), accepting Python integers with value that is larger than the maximal value for the C type or less than the minimal value for the corresponding signed integer type of the same size is now deprecated.gh-131185:
PyGILState_Ensure()no longer crashes when called after interpreter finalization.gh-108512: Add functions
PySys_GetAttr(),PySys_GetAttrString(),PySys_GetOptionalAttr()andPySys_GetOptionalAttrString().
Build¶
gh-138489: When cross-compiling for WASI by
build_wasmorbuild_emscripten, thebuild-details.jsonstep is now included in the build process, just like with native builds.This fixes the
libinstalltask which requires thebuild-details.jsonfile during the process.gh-138497: The LLVM version used by the JIT at build time can now be modified using the
LLVM_VERSIONenvironment variable. Use this at your own risk, as there is only one officially supported LLVM version. For more information, please checkTools/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:
./configurenow warns when--enable-optimizationsandCFLAGS=-O0are both set, suggesting removing-O0fromCFLAGSfor optimal performance. Patch by Taegyun Kim.gh-132339: Add support for OpenSSL 3.5.
gh-135621: PyREPL no longer depends on the
cursesstandard 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
MAXLOGNAMEin theconfigure.acscript.gh-134923: Windows builds with profile-guided optimization enabled now use
/GENPROFILEand/USEPROFILEinstead of deprecated/LTCG:options.gh-134632: Fixed
build-details.jsongeneration to useINCLUDEPY, in order to reference thepythonX.Ysubdirectory of the include directory, as required in PEP 739, instead of the top-level include directory.gh-134486: The
ctypesmodule now performs a more portable test for the definition of alloca(3), fixing a compilation failure on NetBSD.gh-134455: Fixed
build-details.jsongeneration to use the correctc_api.headersas defined in PEP 739, instead ofc_api.include.gh-134273: Add support for configuring compiler flags for the JIT with
CFLAGS_JITgh-115119: Removed implicit fallback to the bundled copy of the
libmpdeclibrary. Now this should be explicitly enabled via--with-system-libmpdecset tonoor--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¶
gh-132930: Marks the installer for Windows as deprecated and updates documentation to cover the new Python install manager.
gh-127405: Add
ABIFLAGStosysconfig.get_config_vars()on Windows. Patch by Xuehai Pan.
Tools/Demos¶
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/fdapproach on all Apple platforms, not just macOS. This avoids crashes caused by guarded file descriptors.gh-132678: Add
--prioritizeto-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/testcan now be correctly executed as standalone scripts.
Security¶
gh-115322: The underlying extension modules behind
readline:,subprocess, andctypesnow raise audit events on previously uncovered code paths that could lead to file system access related to C function calling and external binary execution. Thectypes.call_functionaudit hook has also been fixed to use an unsigned value for itsfunction pointer.
Library¶
gh-133490: Add color support to PDB in remote mode.
gh-132493: Avoid eagerly evaluating annotations in functions decorated with
reprlib.recursive_repr().gh-130645: Add color to stdlib argparse CLIs. Patch by Hugo van Kemenade.
gh-119180: Make
annotationlib.get_annotations()succeed with theFORWARDREFformat if evaluating the annotations throws an exception other thanNameErrororAttributeError.gh-133351: Fix remote PDB to correctly request tab completions for Python expressions from the server when completing a continuation line of a multi-line Python block.
gh-133367: Add the
--feature-version,--optimize, and--show-emptyoptions to theastcommand-line interface. Patch by Semyon Moroz.gh-133363: The
cmd.Cmdclass has been fixed to reliably call thecompletedefaultmethod whenever thedo_shellmethod is not defined and tab completion is requested for a line beginning with!.gh-133306: Use
\zinstead of\Zinfnmatch.translate()andglob.translate().gh-133306: Support
\zas a synonym for\Zinregular expressions.gh-133300: Make
argparse.ArgumentParser’ssuggest_on_errora keyword-only parameter. Patch by Hugo van Kemenade.gh-133290: Fix attribute caching issue when setting
ctypes._Pointer._type_in the undocumented and deprecatedctypes.SetPointerType()function and the undocumentedset_type()method.gh-133223: When PDB is attached to a remote process, do a better job of intercepting Ctrl+C and forwarding it to the remote process.
gh-133153: Do not complete
pdbcommands ininteractmode ofpdb.gh-133139: Add the
curses.assume_default_colors()function, a refinement of thecurses.use_default_colors()function which allows to change the color pair0.gh-133089: Use original timeout value for
subprocess.TimeoutExpiredwhen the funcsubprocess.run()is called with a timeout instead of sometimes a confusing partial remaining time out value used internally on the finalwait().gh-133036:
codecs.open()is now deprecated. Useopen()instead. Contributed by Inada Naoki.gh-132987: Many builtin and extension functions which accept an unsigned integer argument, now use
__index__()if available.gh-124703: Set return code to
1when aborting process frompdb.gh-133005: Support passing
presetoption totarfile.open()when using'w|xz'mode.gh-115032: Support for custom logging handlers with the strm argument is deprecated and scheduled for removal in Python 3.16. Define handlers with the stream argument instead. Patch by Mariusz Felisiak.
gh-132991: Add
socket.IP_FREEBINDconstant on Linux 2.4 and later.gh-132995: Bump the version of pip bundled in ensurepip to version 25.1.1
gh-132933: The zipapp module now applies the filter when creating the list of files to add, rather than waiting until the file is being added to the archive.
gh-121249: Always support the float complex and double complex C types in the
structmodule. Patch by Sergey B Kirpichev.gh-132915:
fcntl.fcntl()andfcntl.ioctl()can now detect a buffer overflow and raiseSystemError. The stack and memory can be corrupted in such case, so treat this error as fatal.gh-132017: Fix error when
pyreplis suspended, then resumed and terminated.gh-132893: Improved
statistics.NormalDist.cdf()accuracy for inputs smaller than the mean.gh-130328: Speedup pasting in
PyREPLon Windows. Fix by Chris Eibl.gh-132882: Fix copying of
typing.Unionobjects containing objects that do not support the|operator.gh-93696: Fixed the breakpoint display error for frozen modules in
pdb.gh-129965: Add MIME types for
.7z,.apk,.deb,.glb,.gltf,.gz,.m4v,.php,.rar,.rpm,.stland.wmv. Patch by Hugo van Kemenade.gh-132742:
fcntl.fcntl()now supports arbitrary bytes-like objects, not onlybytes.fcntl.ioctl()now automatically retries system calls failing with EINTR and releases the GIL during a system call even for large bytes-like object.gh-132451: The CLI for the PDB debugger now accepts a
-p PIDargument to allow attaching to a running process. The process must be running the same version of Python as the one running PDB.gh-125618: Add a format parameter to
annotationlib.ForwardRef.evaluate(). Evaluating annotations in theFORWARDREFformat now succeeds in more cases that would previously have raised an exception.gh-132805: Fix incorrect handling of nested non-constant values in the FORWARDREF format in
annotationlib.gh-132673: Fix
AssertionErrorraised onctypes.Structurewith_align_ = 0and_fields_ = [].gh-132578: Rename the
threading.Thread._handlefield to avoid shadowing methods defined on subclasses ofthreading.Thread.gh-132561: Fix the public
lockedmethod ofmultiprocessing.SemLockclass. Also adding 2 tests for the derivatedmultiprocessing.Lockandmultiprocessing.RLockclasses.gh-121468: Add
pdb.set_trace_async()function to supportawaitstatements inpdb.gh-132493:
typing.Protocolnow usesannotationlib.get_annotations()when checking whether or not an instance implements the protocol withisinstance(). This enables support forisinstancechecks against classes with deferred annotations.gh-132536: Do not disable
PY_THROWevent inbdbbecause it can’t be disabled.gh-132527: Include the valid typecode ‘w’ in the error message when an invalid typecode is passed to
array.array.gh-132099: The Bluetooth socket with the
BTPROTO_HCIprotocol on Linux now accepts an address in the format of an integerdevice_id, not only a tuple(device_id,).gh-81793: Fix
os.link()on platforms (like Linux) where the systemlink()function does not follow symlinks. On Linux, it now follows symlinks by default or iffollow_symlinks=Trueis specified. On Windows, it now raises an error iffollow_symlinks=Trueis passed. On macOS, it now raises an error iffollow_symlinks=Falseis passed and the systemlinkat()function is not available at runtime.gh-132493: Support creation of
typing.Protocolclasses with annotations that cannot be resolved at class creation time.gh-132491: Rename
annotationlib.value_to_stringtoannotationlib.type_repr()and provide better handling for function objects.gh-132426: Add
annotationlib.get_annotate_from_class_namespace()as a helper for accessing annotations in metaclasses, and removeannotationlib.get_annotate_function.gh-70145: Add support for channels in Bluetooth HCI protocol (
BTPROTO_HCI).gh-131913: Add a shortcut function
multiprocessing.Process.interrupt()alongside the existingmultiprocessing.Process.terminate()andmultiprocessing.Process.kill()for an improved control over child process termination.gh-132439: Fix
PyREPLon Windows: characters entered via AltGr are swallowed. Patch by Chris Eibl.gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly BSD. Add support for cid and bdaddr_type in the BTPROTO_L2CAP address on FreeBSD. Return cid in
getsockname()for BTPROTO_L2CAP if it is not zero.gh-132106:
QueueListener.startnow raises aRuntimeErrorif the listener is already started.gh-132417: Fix a
NULLpointer dereference when a C function called usingctypeswithrestypepy_objectreturnsNULL.gh-132385: Fix instance error suggestions trigger potential exceptions in
object.__getattr__()intraceback.gh-125866: Add optional add_scheme argument to
urllib.request.pathname2url(); when set to true, a complete URL is returned. Likewise add optional require_scheme argument tourl2pathname(); when set to true, a complete URL is accepted.gh-132308: A
traceback.TracebackExceptionnow correctly renders the__context__and__cause__attributes from falseyException, and theexceptionsattribute from falseyExceptionGroup.gh-130645: Add colour to
argparsehelp output. Patch by Hugo van Kemenade.gh-127495: In PyREPL, append a new entry to the
PYTHON_HISTORYfile after every statement. This should preserve command-line history after interpreter is terminated. Patch by Sergey B Kirpichev.gh-129463: Comparison of
annotationlib.ForwardRefobjects no longer uses the internal__code__and__ast_node__attributes, which are used as caches.gh-132250: Fixed the
SystemErrorincProfilewhen locating the actual C function of a method raises an exception.gh-132064:
annotationlib.get_annotations()now uses the__annotate__attribute if it is present, even if__annotations__is not present. Additionally, the function now raises aTypeErrorif it is passed an object that does not have any annotatins.gh-130664: Support the
'_'digit separator in formatting of the integral part ofDecimal’s. Patch by Sergey B Kirpichev.gh-131952: Add color output to the json CLI. Patch by Tomas Roun.
gh-132063: Prevent exceptions that evaluate as falsey (namely, when their
__bool__method returnsFalseor their__len__method returns 0) from being ignored byconcurrent.futures.ProcessPoolExecutorandconcurrent.futures.ThreadPoolExecutor.gh-132106:
logging.handlers.QueueListenernow implements the context manager protocol, allowing it to be used in awithstatement.gh-132054: The
application/yamlmime type (RFC 9512) is now supported bymimetypes. Patch by Sasha “Nelie” Chernykh and Hugo van Kemenade.gh-119605: Respect
follow_wrappedfor__init__()and__new__()methods when getting the class signature for a class withinspect.signature(). Preserve class signature after wrapping withwarnings.deprecated(). Patch by Xuehai Pan.gh-118761: Improve import times by up to 33x for the
shlexmodule, and improve the performance ofshlex.quote()by up to 12x. Patch by Adam Turner.gh-85302: Add support for
BTPROTO_SCOin sockets on FreeBSD.gh-131757: Make
functools.lru_cache()call the cached function unlocked to allow concurrency.gh-131423:
sslcan show descriptions for errors added in OpenSSL 3.4.1. Patch by Bénédikt Tran.gh-131434: Improve error reporting for incorrect format in
time.strptime().gh-131524: Add help message to
platformcommand-line interface. Contributed by Harry Lees.gh-100926: Move
ctypes.POINTER()types cache from a global internal cache (_pointer_type_cache) to thectypes._CData.__pointer_type__attribute of the correspondingctypestypes. This will stop the cache from growing without limits in some situations.gh-85702: If
zoneinfo._common.load_tzdatais given a package without a resource aZoneInfoNotFoundErroris raised rather than aIsADirectoryError.gh-123471: Make concurrent iterations over
itertools.repeatsafe under free-threading.gh-131127: Systems using LibreSSL now successfully build.
gh-89157: Make the pure Python implementation of
datetime.date.fromisoformat(), only accept ASCII strings for consistency with the C implementation.gh-130941: Fix
configparser.ConfigParserparsing empty interpolation withallow_no_valueset toTrue.gh-110067: Make
heapqmax-heap functionsheapq.heapify_max(),heapq.heappush_max(),heapq.heappop_max(), andheapq.heapreplace_max()public. Previous underscored naming is kept for backwards compatibility. Additionally, the missing functionheapq.heappushpop_max()has been added to both the C and Python implementations.gh-129098: Fix REPL traceback reporting when using
compile()with an inexisting file. Patch by Bénédikt Tran.gh-130631:
http.cookiejar.join_header_words()is now more similar to the original Perl version. It now quotes the same set of characters and always quote values that end with"\n".gh-130482: Add ability to specify name for
tkinter.OptionMenuandtkinter.ttk.OptionMenu.gh-77065: Add keyword-only optional argument echo_char for
getpass.getpass()for optional visual keyboard feedback support. Patch by Semyon Moroz.gh-130317: Fix
PyFloat_Pack2()andPyFloat_Unpack2()for NaN’s with payload. This corrects round-trip forstruct.unpack()andstruct.pack()in case of the IEEE 754 binary16 “half precision” type. Patch by Sergey B Kirpichev.gh-130402: Joining running daemon threads during interpreter shutdown now raises
PythonFinalizationError.gh-130167: Improve speed of
difflib.IS_LINE_JUNK(). Patch by Semyon Moroz.gh-101410: Added more detailed messages for domain errors in the
mathmodule.gh-128384: Make
warnings.catch_warningsuse a context variable for holding the warning filtering state if thesys.flags.context_aware_warningsflag is set to true. This makes using the context manager thread-safe in multi-threaded programs. The flag is true by default in free-threaded builds and is otherwise false. The value of the flag can be overridden by the-X context_aware_warningscommand-line option or by thePYTHON_CONTEXT_AWARE_WARNINGSenvironment variable.gh-129719: Fix missing
socket.CAN_RAW_ERR_FILTERconstant in the socket module on Linux systems. It was missing since Python 3.11.gh-129027: Raise
DeprecationWarningforsys._clear_type_cache(). This function was deprecated in Python 3.13 but it didn’t raise a runtime warning.gh-128307: Add
eager_startkeyword argument toasyncio.loop.create_task()gh-127604: Add support for printing the C stack trace on systems that support it via
faulthandler.dump_c_stack()or via the c_stack argument infaulthandler.enable().gh-127385: Add the
F_DUPFD_QUERYconstant to thefcntlmodule.gh-126838: Add resolve_host keyword-only parameter to
urllib.request.url2pathname(), and fix handling of file URLs with authorities.gh-82129: Fix
NameErrorwhen callingtyping.get_type_hints()on adataclasses.dataclass()created bydataclasses.make_dataclass()with un-annotated fields.gh-122559: Remove
__reduce__()and__reduce_ex__()methods that always raiseTypeErrorin the C implementation ofio.FileIO,io.BufferedReader,io.BufferedWriterandio.BufferedRandomand replace them with default__getstate__()methods that raiseTypeError. This restores fine details of behavior of Python 3.11 and older versions.gh-122179:
hashlib.file_digest()now raisesBlockingIOErrorwhen no data is available during non-blocking I/O. Before, it added spurious null bytes to the digest.gh-53032: Expose
decimal.IEEEContext()to support creation of contexts corresponding to the IEEE 754 (2008) decimal interchange formats. Patch by Sergey B Kirpichev.gh-120220: Deprecate the
tkinter.Variablemethodstrace_variable(),trace_vdelete()andtrace_vinfo(). Methodstrace_add(),trace_remove()andtrace_info()can be used instead.gh-113539:
webbrowser: Names in theBROWSERenvironment variable can now refer to already registered web browsers, instead of always generating a new browser command.This makes it possible to set
BROWSERto the value of one of the supported browsers on macOS.bpo-44172: Keep a reference to original
curseswindows in subwindows so that the original window does not get deleted before subwindows.gh-75223: Deprecate undotted extensions in
mimetypes.MimeTypes.add_type(). Patch by Hugo van Kemenade.
IDLE¶
gh-112936: fix IDLE: no Shell menu item in single-process mode.
Documentation¶
gh-107006: Move documentation and example code for
threading.localfrom 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:
-Jis 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
_colorizemodule.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 PIDcommand-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 aspython -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()andPyFloat_Unpack4()on RISC-V.gh-133197: Improve
SyntaxErrorerror messages for incompatible string / bytes prefixes.gh-133231: Add new utilities of observing JIT compilation:
sys._jit.is_available(),sys._jit.is_enabled(), andsys._jit.is_active().
Library¶
gh-133194:
ast.parse()will no longer parse new PEP 758 syntax with older feature_version passed.
Core and Builtins¶
gh-131798: Split
CALL_LENinto several uops allowing the JIT to remove them when optimizing. Patch by Diego Russo.gh-131798: Use
sym_new_typeinstead ofsym_new_not_nullfor _BUILD_STRING, _BUILD_SETgh-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_INTin JIT. Patch by Tomas Roungh-132952: Speed up startup with the
-Sargument by importing the private_iomodule instead ofio. 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_LENby setting the return type to int. Patch by Diego Russogh-131798: Split
CALL_TUPLE_1into several uops allowing the JIT to remove some of them. Patch by Tomas Roungh-131798: Split
CALL_STR_1into several uops allowing the JIT to remove some of them. Patch by Tomas Roungh-132825: Enhance unhashable key/element error messages for
dictandset. 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 callingrepr(item). Patch by Victor Stinner.gh-132661: Implement PEP 750 (Template Strings). Add new syntax for t-strings and implement new internal
string.templatelib.Templateandstring.templatelib.Interpolationtypes.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 aNonesecond 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¶
Core and Builtins¶
gh-132639: Added
PyLong_AsNativeBytes(),PyLong_FromNativeBytes()andPyLong_FromUnsignedNativeBytes()to the limited C API.gh-100239: Add specialisation for
BINARY_OP/SUBSCRon 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
warningsfilters.gh-132457: Make
staticmethod()andclassmethod()generic.gh-131798: Use
sym_new_typeinstead ofsym_new_not_nullfor _BUILD_LIST, _BUILD_SET, _BUILD_MAPgh-131798: Split
CALL_TYPE_1into several uops allowing the JIT to remove some of them.gh-132386: Fix crash when passing a dict subclass as the
globalsparameter toexec().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
PyCFunctionslots 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, whentype.__annotations__was deleted.gh-131798: Allow the JIT to remove an extra
_TO_BOOL_BOOLinstruction after_CONTAINS_OP_DICTby 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 thePy_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 ofwith(resp.async with). Patch by Bénédikt Tran.gh-131798: Allow the JIT to remove unicode guards after
_BINARY_OP_SUBSCR_STR_INTby 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-argumentpow()and the binary power operator.gh-130070: Fixed an assertion error for
exec()passed a stringsourceand a non-Noneclosure. 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:
elifstatements that follow anelseblock now have a specific error message.gh-69605: Add module autocomplete to PyREPL.
gh-128555: Add the
sys.flags.thread_inherit_contextflag.This flag is set to true by default on the free-threaded build and false otherwise. If the flag is true, starting a new thread using
threading.Threadwill, by default, use a copy of thecontextvars.Contextfrom the caller ofthreading.Thread.start()rather than using an empty context.Add the
-X thread_inherit_contextcommand-line option andPYTHON_THREAD_INHERIT_CONTEXTenvironment variable, which set thethread_inherit_contextflag.Add the
contextkeyword parameter toThread. It can be used to explicitly pass a context value to be used by a new thread.Make the
_contextvarsmodule built-in.
gh-123539: Improve
SyntaxErrormessage for usingimport ... asandfrom ... import ... aswith not a name.gh-102567:
-X importtimenow accepts value2, which indicates that animporttimeentry 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
TypeErroroccurs duringdict.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
hostflagsmember fromPySSLContextstruct.
C API¶
gh-133166: Fix regression where
PyType_GetModuleByDef()returns NULL without settingTypeErrorwhen a static type is passed.gh-133164: Add
PyUnstable_Object_IsUniqueReferencedTemporary()function for determining if an object exists as a unique temporary variable on the interpreter’s stack. This is a replacement for some cases where checking thatPy_REFCNT()is one is no longer sufficient to determine if it’s safe to modify a Python object in-place with no visible side effects.gh-133140: Add
PyUnstable_Object_IsUniquelyReferenced()as a replacement forPy_REFNCT(op) == 1on free threaded builds of Python.gh-131747: On non-Windows platforms, deprecate using
ctypes.Structure._pack_to use a Windows-compatible layout on non-Windows platforms. The layout should be specified explicitly by settingctypes.Structure._layout_to'ms'.gh-128972: For non-free-threaded builds, the memory layout of
PyASCIIObjectis reverted to match Python 3.13. (Note that the structure is not part of stable ABI and so its memory layout is guaranteed to remain stable.)gh-133079: The undocumented APIs
Py_C_RECURSION_LIMITandPyThreadState.c_recursion_remaining, added in 3.13, are removed without a deprecation period.gh-132987: The
kandKformats inPyArg_Parse()now support the__index__()special method, like all other integer formats.gh-132909: Fix an overflow when handling the K format in
Py_BuildValue(). Patch by Bénédikt Tran.gh-132798: Deprecated and undocumented functions
PyUnicode_AsEncodedObject(),PyUnicode_AsDecodedObject(),PyUnicode_AsEncodedUnicode()andPyUnicode_AsDecodedUnicode()are scheduled for removal in 3.15.gh-132470: Creating a
ctypes.CFieldwith a byte_size that does not match the actual type size now raises aValueErrorinstead of crashing the interpreter.gh-112068: [Reverted in gh-136991] Add support of nullable arguments in
PyArg_Parse()and similar functions. Adding?after any format unit makesNonebe accepted as a value.gh-50333: Non-tuple sequences are deprecated as argument for the
(items)format unit inPyArg_ParseTuple()and other argument parsing functions if items contains format units which store a borrowed buffer or a borrowed reference.
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_TARGETin target triples, ensuring that SDK version minimums are honored.gh-133167: Fix compilation process with
--enable-optimizationsand--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
PClayoutscript now allows passing--include-tcltkon 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¶
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_*andMB_*constants are added towinsound.gh-91349: Replaces our copy of
zlibwithzlib-ng, for performance improvements inzlib.gh-131025: Update Windows installer to ship with SQLite 3.49.1.
Tools/Demos¶
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_paramsis 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¶
gh-132174: Fix function name in error message of
_interpreters.run_string.gh-132171: Fix crash of
_interpreters.run_stringon string subclasses.gh-129204: Introduce new
_PYTHON_SUBPROCESS_USE_POSIX_SPAWNenvironment variable knob insubprocessto control the use ofos.posix_spawn().gh-132159: Do not shadow user arguments in generated
__new__()by decoratorwarnings.deprecated. Patch by Xuehai Pan.gh-132168: The
ctypes.py_objecttype now supports subscription, making it a generic type.gh-84481: Add the
zipfile.ZipFile.data_offsetattribute, which stores the offset to the beginning of ZIP data in a file when available. When thezipfile.ZipFileis opened in either mode'w'or'x'and the underlying file does not supporttell(), the value will beNoneinstead.gh-132075: Fix possible use of
socketaddress structures with uninitialized members. Now all structure members are initialized with zeroes by default.gh-118761: Improve import times by up to 27x for the
stringmodule. Patch by Adam Turner.gh-125434: Display thread name in
faulthandler. Patch by Victor Stinner.gh-132002: Fix crash when deallocating
contextvars.ContextVarwith weird unahashable string names.gh-131938:
xml.etree.ElementTree: update the error message when an element to remove viaElement.removeis not found. Patch by Bénédikt Tran.gh-115942: Add
threading.RLock.locked(),multiprocessing.Lock.locked(),multiprocessing.RLock.locked(), and allowmultiprocessing.managers.SyncManager.Lock()andmultiprocessing.managers.SyncManager.RLock()to proxylocked()call.gh-131974: Fix several thread-safety issues in
ctypeson the free threaded build.gh-118761: Improve the import time of the
astmodule by extracting theunparse()function to a helper module.gh-107369: Improved performance of
textwrap.indent()by an average of ~1.3x. Patch by Adam Turner.gh-131792: Improved performance of
textwrap.dedent()by an average of ~2.4x, (with improvements of up to 4x for large inputs), and fixed a bug where blank lines with whitespace characters other than space or horizontal tab were not normalised to the newline. Patch by Adam Turner, Marius Juston, and Pieter Eendebak.gh-131668:
socket: Fix code parsing AF_BLUETOOTH socket addresses.gh-60115: Support frozen modules for
linecache.getline().gh-131492: Fix a resource leak when constructing a
gzip.GzipFilewith a filename fails, for example when passing an invalidcompresslevel.gh-131435: 10-20% performance improvement of
random.randint().gh-131461: Fix
ResourceWarningwhen constructing agzip.GzipFilein write mode with a broken file object.gh-125866: Deprecate the
nturl2pathmodule. Callurllib.request.url2pathname()andpathname2url()instead.gh-126367: Fix issue where
urllib.request.url2pathname()raisedOSErrorwhen given a Windows URI containing a colon character not following a drive letter, such as before an NTFS alternate data stream.gh-120144: Disable
CALLevent inbdbinmonitoringbackend when we don’t need any new events on the code object to get a better performance.gh-131358: Register
cseuckras an encoding alias foreuc_kr.gh-131325: Fix sendfile fallback implementation to drain data after writing to transport in
asyncio.gh-90548:
platform.libc_ver()can now detect and report the version ofmuslon Alpine Linux.gh-129843: Fix incorrect argument passing in
warnings.warn_explicit().gh-70647: When creating a
datetimeobject with an out of range date a more informative error is raised.gh-130914: Allow
graphlib.TopologicalSorter.prepare()to be called more than once as long as sorting has not started. Patch by Daniel Pope.gh-131236: Allow to generate multiple UUIDs at once via
python -m uuid --count.gh-126895: Fix
readlinein free-threaded build.gh-121468:
$_asynctaskis added as apdbconvenience variable to access the current asyncio task if applicable.gh-118761: Improve import time of
localeusing lazy importre. Patch by Semyon Moroz.gh-129598: Fix
ast.unparse()whenast.Interactivecontains multiple statements.gh-85162: The
http.servermodule now includes built-in support for HTTPS servers exposed byhttp.server.HTTPSServer. This functionality is exposed by the command-line interface (python -m http.server) through the--tls-cert,--tls-keyand--tls-password-fileoptions. Patch by Semyon Moroz.gh-129463: The implementations of equality and hashing for
annotationlib.ForwardRefnow use all attributes on the object. TwoForwardRefobjects are equal only if all attributes are equal.gh-128593:
annotationlib.ForwardRefobjects no longer cache their value when they are successfully evaluated. Successive calls toannotationlib.ForwardRef.evaluate()may return different values.gh-117779: Fix reading duplicated entries in
zipfileby name. Reading duplicated entries (except the last one) byZipInfonow emits a warning instead of raising an exception.gh-128715: The class of
Structure/Unionfield descriptors is now available asCField, and has new attributes to aid debugging and introspection.gh-128055: Fix
test.test_sysconfig.test_sysconfigdata_jsonwhen running outside the build directory (eg. after installing).gh-126037:
xml.etree.ElementTree: Fix a crash inElement.find,Element.findtextandElement.findallwhen the tag to find implements an__eq__()method mutating the element being queried. Patch by Bénédikt Tran.gh-127794: When headers are added to
email.message.Messageobjects, either throughemail.message.Message.__setitem__()oremail.message.Message.add_header(), the field name is now validated according to RFC 5322, Section 2.2 and aValueErroris raised if the field name contains any invalid characters.gh-123599: Deprecate
pathlib.PurePath.as_uri(); usepathlib.Path.as_uri()instead.gh-126033:
xml.etree.ElementTree: Fix a crash inElement.removewhen the element is concurrently mutated. Patch by Bénédikt Tran.gh-120144: Add the optional backend of
sys.monitoringtobdband use it forpdb.gh-74598: Add
fnmatch.filterfalse()for excluding names matching a pattern. Patch by Bénédikt Tran.gh-114917: Add support for AI_NUMERICSERV in getaddrinfo emulation
bpo-17254: Added aliases for Thai Language using Microsoft Code Pages.
Documentation¶
gh-131417: Mention
asyncio.Futureandasyncio.Taskin generic classes list.
Core and Builtins¶
gh-131798: Allow the JIT to remove an extra
_TO_BOOL_BOOLinstruction after_CONTAINS_OP_SETby 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 thesysmodule. 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_FreeDelayedin free-threaded build.gh-131670: Fix
anext()failing on sync__anext__()raising an exception.gh-131666: Fix signature of
anext_awaitable.closeobjects. 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()andPyLong_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
columnandend_columninastlocations.gh-130704: Optimize
LOAD_FASTand 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¶
Core and Builtins¶
gh-130080: Implement PEP 765: Disallow return/break/continue that exit a finally block.
gh-129900: Fix return codes inside
SystemExitnot 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
rangeby using a freelist.
C API¶
Build¶
gh-131865: The DTrace build now properly passes the
CCandCFLAGSvariables to thedtracecommand when utilizing SystemTap on Linux.gh-131675: Fix mimalloc library builds for 32-bit ARM targets.
gh-131691: clang-cl on Windows needs option
/EHato support SEH (structured exception handling) correctly. Fix by Chris Eibl.gh-131278: Add optimizing flag
WITH_COMPUTED_GOTOSto 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
KeyErrorwhen handling object sections during JIT building process.
Python 3.14.0 alpha 6¶
Release date: 2025-03-14
macOS¶
gh-128540: Ensure web browser is launched by
webbrowser.open()on macOS, even forfile://URLs.
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
msgctxtwhen compiling messages in msgfmt.gh-130453: Extend support for specifying custom keywords in pygettext.
gh-130195: Add warning messages when
pygettextunimplemented-a/--extract-alloption 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
TERMvariable in the testing environment.gh-129401: Fix a flaky test in
test_repr_rlockthat checks the representation ofmultiprocessing.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¶
gh-131204: Use monospace font from System Font Stack for cross-platform support in
difflib.HtmlDiff.gh-131196: Improve performance of
uuid.UUID.hexanduuid.UUID.__str__.gh-130940: The behavior of
PyConfig.use_system_loggerwas modified to be enabled by default on iOS. It remains disabled by default on macOS.gh-131123: Supported completions for attributes of convenience variables in
pdb.gh-93096: Removed undocumented CLI
python -m difflib. Usepython -m doctest Lib/difflib.py -vinstead. Patch by Semyon Moroz.gh-93096: Removed undocumented
-tand-varguments ofpython -m pickle. Usepython -m doctest Lib/pickle.py -vinstead. Patch by Semyon Moroz.gh-81267: Correct
time.sleep()error message when an object that cannot be interpreted as an integer or float is provided.gh-93096: Removed undocumented
-tand-varguments ofpython -m pickletools. Usepython -m doctest Lib/pickletools.py -vinstead. Patch by Semyon Moroz.gh-131045: Fix issue with
__contains__, values, and pseudo-members forenum.Flag.gh-130959: Fix pure-Python implementation of
datetime.time.fromisoformat()to reject times with spaces in fractional part (for example,12:34:56.400 +02:00), matching the C implementation. Patch by Michał Gorny.gh-130806: Deleting
gzip.GzipFilebefore it is closed now emits aResourceWarning.gh-130637: Add validation for numeric response data in poplib.POP3.stat() method
gh-130665: Only apply locale to calendar CLI when set via
--localeand not viaLANGenvironment variable.gh-130660:
sys.ps1andsys.ps2are now restored aftercode.interact()call.gh-130608: Remove dirs_exist_ok argument from
pathlib.Path.copy()andcopy_into(). These methods are new in Python 3.14.gh-130461: Remove
.. index::directives from theuuidmodule documentation. These directives previously created entries in the general index forgetnode()as well as theuuid1(),uuid3(),uuid4(),uuid5(), anduuid8()constructor functions.gh-130379: The zipapp module now calculates the list of files to be added to the archive before creating the archive. This avoids accidentally including the target when it is being created in the source directory.
gh-82987: Inline breakpoints like
breakpoint()orpdb.set_trace()will always stop the program at calling frame, ignoring theskippattern (if any).gh-125377:
<tab>at the beginning of the line inpdbmulti-line input will fill in a 4-space indentation now, instead of inserting a\tcharacter.gh-125413: Ensure the path returned from
pathlib.Path.copy()ormove()has freshinfo.gh-65697: stdlib configparser will now attempt to validate that keys it writes will not result in file corruption (creating a file unable to be accurately parsed by a future read() call from the same parser). Attempting a corrupting write() will raise an InvalidWriteError.
gh-125413: Speed up
Path.copyby making better use ofinfointernally.gh-130285: Fix corner case for
random.sample()allowing the counts parameter to specify an empty population. So now,sample([], 0, counts=[])andsample('abc', k=0, counts=[0, 0, 0])both give the same result assample([], 0).gh-124703: Executing
quitcommand inpdbwill raisebdb.BdbQuitwhenpdbis started from an interactive console usingbreakpoint()orpdb.set_trace().gh-107773: Make
datetimesubclass__repr__()consistent both implementations. Patch by Semyon Moroz.gh-130250: Fix regression in
traceback.print_last().gh-123471: Make concurrent iterations over
itertools.batchedsafe under free-threading.gh-130230: Fix crash in
pow()with onlyDecimalthird argument.gh-126944: Show explicit errors when required arguments of
pdbcommands are missinggh-127750: Improve repr of
functools.singledispatchmethodmethods and descriptors.gh-128520: Apply type conversion consistently in
pathlib.PurePathandPathmethods can accept a path object as an argument, such asmatch()andrename(). The argument is now converted to path object if it lacks awith_segments()attribute, and not otherwise.gh-118761: Reverts a change in the previous release attempting to make some stdlib imports used within the
subprocessmodule lazy as this was causing errors during__del__finalizers calling methods such asterminate, orkill, orsend_signal.gh-130164: Fixed failure to raise
TypeErrorininspect.Signature.bind()for positional-only arguments provided by keyword when a variadic keyword argument (e.g.**kwargs) is present.gh-130151: Fix reference leaks in
_hashlib.hmac_new()and_hashlib.hmac_digest(). Patch by Bénédikt Tran.gh-130145: Fix
asyncio.AbstractEventloop.run_forever()when another loop is already running.gh-130139: Fix bug where
ast.parse()did not error on AST input which is not of the correct type, when called with optimize=False.gh-127260: Forbid the use of colon (“:”) as a fractional component separator and other improvements to the consistency of error raising between the C and Python implementations of
datetime.time.fromisoformat()anddatetime.datetime.fromisoformat(). Patch by Semyon Moroz.gh-85795: Using
super()and__class__closure variable in user-defined methods oftyping.NamedTuplesubclasses is now explicitly prohibited at runtime. Contributed by Bartosz Sławecki in gh-130082.gh-118761: Improve import time of
cmdby lazy importinginspectand removingstring. Patch by Semyon Moroz.gh-129726: Fix
gzip.GzipFileraising an unraisable exception during garbage collection when referring to a temporary object by breaking the reference loop withweakref.gh-127750: Remove broken
functools.singledispatchmethod()caching introduced in gh-85160. Achieve the same performance using different optimization.gh-129948: Add support for shared
settomultiprocessing.managers.SyncManagerviaSyncManager.set().gh-129965: Update MIME types for
.aviand.wav. Add MIME types for.docx,.pptx,.xlsx,.epub,.flac,.m4a,.odg,.odp,.ods,.odt,.oga,.ogg,.ogxand.weba. Patch by Hugo van Kemenade.gh-129889: Support context manager protocol by
contextvars.Token. Patch by Andrew Svetlov.gh-97850: Update the deprecation warning of
importlib.abc.Loader.load_module.gh-129678:
configparser.ConfigParser: do not write an empty unnamed sectiongh-128641: Restore
configparser.ConfigParser.read()performance.gh-129569: Fix
unicodedata.normalize()to always return a built-instrobject when given an input of astrsubclass, regardless of whether the string is already normalized.gh-128231: Execution of multiple statements in the new REPL now stops immediately upon the first exception encountered. Patch by Bartosz Sławecki.
gh-96092: Fix bug in
traceback.walk_stack()called with None where it was skipping more frames than in prior versions. This bug fix also changes walk_stack to walk the stack in the frame where it was called rather than where it first gets used.gh-129288: Add optional
l2_cidandl2_bdaddr_typefields tosocketBTPROTO_L2CAPsockaddr tuple.gh-128703: Fix
mimetypes.guess_type()to use default mapping for emptyContent-Typein registry.gh-128647: Eagerly write to buffers passed to
gzip.GzipFile’sreadinto()andreadinto1()implementations, avoiding unnecessary allocations. Patch by Chris Markiewicz.gh-128184: Improve display of
annotationlib.ForwardRefobject withininspect.Signaturerepresentations. This also fixes aNameErrorthat was raised when usingdataclasses.dataclass()on classes with unresolvable forward references.gh-128041: Add
concurrent.futures.ProcessPoolExecutor.terminate_workers()andconcurrent.futures.ProcessPoolExecutor.kill_workers()as ways to terminate or kill all living worker processes in the given pool. (Contributed by Charles Machalow in gh-130849.)gh-127647: Add protocols
io.Readerandio.Writeras alternatives totyping.IO,typing.TextIO, andtyping.BinaryIO.gh-109798: Added additional information into error messages in
datetime, and made the messages more consistent between the C and Python implementations. Patch by Semyon Moroz.gh-125746: Delay deprecated
zipimport.zipimporter.load_module()removal time to 3.15. Usezipimport.zipimporter.exec_module()instead.gh-74028: Add the optional
buffersizeparameter toconcurrent.futures.Executor.map()to limit the number of submitted tasks whose results have not yet been yielded. If the buffer is full, iteration over the iterables pauses until a result is yielded from the buffer.gh-124927: Non-printing characters are now properly handled in the new REPL.
gh-124096: Turn on virtual terminal mode and enable bracketed paste in REPL on Windows console. (If the terminal does not support bracketed paste, enabling it does nothing.)
gh-89083: Add
uuid.uuid7()for generating UUIDv7 objects as specified in RFC 9562. Patch by Bénédikt Tran.gh-89083: Add
uuid.uuid6()for generating UUIDv6 objects as specified in RFC 9562. Patch by Bénédikt Tran.gh-117151: Increase
io.DEFAULT_BUFFER_SIZEfrom 8k to 128k and adjustopen()on platforms whereos.fstat()provides ast_blksizefield (such as Linux) to usemax(min(blocksize, 8 MiB), io.DEFAULT_BUFFER_SIZE)rather than always using the device block size. This should improve I/O performance. Patch by Romain Morotti.gh-105499: Make
types.UnionTypean alias fortyping.Union. Bothint | strandUnion[int, str]now create instances of the same type. Patch by Jelle Zijlstra.gh-93096: Document the command-line for
mimetypes. It now exits with1on failure instead of0and2on incorrect command-line parameters instead of1. Also, errors are printed to stderr instead of stdout and their text is made tighter. Patch by Oleg Iarygin and Hugo van Kemenade.
Documentation¶
gh-125722: Require Sphinx 8.2.0 or later to build the Python documentation. Patch by Adam Turner.
gh-129712: The wheel tags supported by each macOS universal SDK option are now documented.
gh-46236: C API: Document
PyUnicode_RSplit(),PyUnicode_Partition()andPyUnicode_RPartition().
Core and Builtins¶
gh-131141: Fix data race in
sys.monitoringinstrumentation while registering callback.gh-130804: Fix support of unicode characters on Windows in the new REPL.
gh-130932: Fix incorrect exception handling in
_PyModule_IsPossiblyShadowinggh-122029:
sys.setprofile()andsys.settrace()will not generate ac_callevent forINSTRUMENTED_CALL_FUNCTION_EXif the callable is a method with a C function wrapped, because we do not generatec_returnevent 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
codeobject withco_conststhat 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 forloops. Add these branches to theco_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_DESTROYnot being sent fromPython/ceval.cPy_DECREF().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
UnicodeDecodeErrororSystemErrorto be raised when using f-strings withlambdaexpressions with non-ASCII characters. Patch by Pablo Galindogh-123044: Make sure that the location of branch targets in
matchcases is in the body, not the pattern.gh-128534: Add branch monitoring (
BRANCH_LEFTandBRANCH_RIGHTevents) forasync forloops.gh-130163: Fix possible crashes related to concurrent change and use of the
sysmodule attributes.gh-122029:
INSTRUMENTED_CALL_KWwill 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_SOURCEdefined, 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
bytearrayfunctions 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
bytearrayiterator 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.jsonfile 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 withset.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
ifor after anelsekeyword.gh-129349:
bytes.fromhex()andbytearray.fromhex()now accepts ASCIIbytesand bytes-like objects.gh-129149: Add fast path for medium-size integers in
PyLong_FromSsize_t(). Patch by Chris Eibl.gh-129107: Make the
bytearraysafe 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.TypeAliasTypenow supports star unpacking.gh-125331:
from __future__ import barry_as_FLUFLnow works in more contexts, including when it is used in files, with the-cflag, 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 tocompile(). 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.ParamSpecand have been specialized with a nested type variable.gh-120608: Adapt
reversed()for use in the free-threading build. Thereversed()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¶
gh-111178: Fix
PyCMethodAPI: replacesize_t nargswithPy_ssize_t nargsinPyCMethod. Patch by Victor Stinner.gh-130947: Add again
PySequence_Fast()to the limited C API. Patch by Victor Stinner.gh-128863: The following private functions are deprecated and planned for removal in Python 3.18:
_PyUnicodeWriter_Init(): replace_PyUnicodeWriter_Init(&writer)withwriter = PyUnicodeWriter_Create(0)._PyUnicodeWriter_Finish(): replace_PyUnicodeWriter_Finish(&writer)withPyUnicodeWriter_Finish(writer)._PyUnicodeWriter_Dealloc(): replace_PyUnicodeWriter_Dealloc(&writer)withPyUnicodeWriter_Discard(writer)._PyUnicodeWriter_WriteChar(): replace_PyUnicodeWriter_WriteChar(&writer, ch)withPyUnicodeWriter_WriteChar(writer, ch)._PyUnicodeWriter_WriteStr(): replace_PyUnicodeWriter_WriteStr(&writer, str)withPyUnicodeWriter_WriteStr(writer, str)._PyUnicodeWriter_WriteSubstring(): replace_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)withPyUnicodeWriter_WriteSubstring(writer, str, start, end)._PyUnicodeWriter_WriteASCIIString(): replace_PyUnicodeWriter_WriteASCIIString(&writer, str)withPyUnicodeWriter_WriteUTF8(writer, str)._PyUnicodeWriter_WriteLatin1String(): replace_PyUnicodeWriter_WriteLatin1String(&writer, str)withPyUnicodeWriter_WriteUTF8(writer, str)._PyUnicodeWriter_Prepare(): (no replacement)._PyUnicodeWriter_PrepareKind(): (no replacement).
The pythoncapi-compat project can be used to get these new public functions on Python 3.13 and older.
Patch by Victor Stinner.
gh-45325: Add a new
pformat parameter toPy_BuildValue()that allows to take a C integer and produce a Pythonboolobject. Patch by Pablo Galindo.
Build¶
gh-131035: Use
-flto=thinfor faster build times using clang-cl on Windows. Patch by Chris Eibl.gh-130740: Ensure that
Python.his included beforestdbool.hunlesspyconfig.his included before or in some platform-specific contexts.gh-130090: Building with
PlatformToolset=ClangCLon 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-interpwas provided to the configure script.gh-129838: Don’t redefine
_Py_NO_SANITIZE_UNDEFINEDwhen compiling with a recent GCC version and undefined sanitizer enabled.gh-82909:
#pragma-based linking withpython3*.libcan 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¶
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_embedtest cases that segfault on BOLT instrument binaries. The tests are only disabled when BOLT is enabled.gh-128003: Add an option
--parallel-threads=Nto 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_unsafewhen necessary.
Security¶
gh-105704: When using
urllib.parse.urlsplit()andurllib.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
NULLpointer dereference inPySys_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
imaplibmodule. 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 aMemoryErroror 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¶
gh-129939: Comparison pages with highlighted changes generated by the
difflib.HtmlDiffclass now support dark mode.gh-129928: Raise
sqlite3.ProgrammingErrorif a user-defined SQL function with invalid number of parameters is created. Patch by Erlend Aasland.gh-129583: Update bundled pip to 25.0.1
gh-129766: Fix crash in
warnings, when calling_release_lock()with no existing lock.gh-129005:
_pyio.FileIO.readall()now allocates, resizes, and fills a data buffer using the same algorithm_io.FileIO.readall()uses.gh-129646: Update the locale alias mapping in the
localemodule to match the latest X Org locale alias mapping and support new locales in Glibc 2.41.gh-128317: Put CLI calendar highlighting in private class, removing
highlight_dayfrom publiccalendar.TextCalendarAPI. Patch by Hugo van Kemenade.gh-129603: Fix bugs where
sqlite3.Rowobjects could segfault if their inheriteddescriptionwas set toNone. Patch by Erlend Aasland.gh-129559: Add
bytearray.resize()method sobytearraycan be efficiently resized in place.gh-129502: Unlikely errors in preparing arguments for
ctypescallback are now handled in the same way as errors raised in the callback of in converting the result of the callback – usingsys.unraisablehook()instead ofsys.excepthook()and not settingsys.last_excand other variables.gh-129403: Corrected
ValueErrormessage forasyncio.Barrierandthreading.Barrier.gh-129409: Fix an integer overflow in the
csvmodule when writing a data field larger than 2GB.gh-126400: Add a socket timeout keyword argument to
logging.handlers.SysLogHandler.gh-118761: Always lazy import
warningsinthreading. Patch by Taneli Hukkinen.gh-118761: Improve import time of
subprocessby lazy importinglocaleandsignal. Patch by Taneli Hukkinen.gh-129346: In
sqlite3, handle out-of-memory when creating user-defined SQL functions.gh-129005: Optimize
_pyio.FileIO.readintoby avoiding unnecessary objects and copies usingos.readinto().gh-129195: Support reporting call graph information from
asyncio.staggered.staggered_race().gh-129205: Add
os.readinto()to read into a buffer object from a file descriptor.gh-128772: Fix
pydocfor methods with the__module__attribute equal toNone.gh-129061: Fix FORCE_COLOR and NO_COLOR when empty strings. Patch by Hugo van Kemenade.
gh-92897: Scheduled the deprecation of the
check_homeargument ofsysconfig.is_python_build()to Python 3.15.gh-129064: Deprecate
sysconfig.expand_makefile_vars(), in favor of usingsysconfig.get_paths()with thevarsargument.gh-128550: Removed an incorrect optimization relating to eager tasks in
asyncio.TaskGroupthat resulted in cancellations being missed.gh-128991: Release the enter frame reference within
bdbcallbackgh-118761: Reduce import time of
pstatsandzipfileby up to 20%, by removing unnecessary imports totyping. Patch by Bénédikt Tran.gh-128978: Fix a
NameErrorinsysconfig.expand_makefile_vars(). Patch by Bénédikt Tran.gh-128961: Fix a crash when setting state on an exhausted
array.arrayiterator.gh-128894: Fix
traceback.TracebackException._format_syntax_errornot to fail on exceptions with custom metadata.gh-128916: Do not attempt to set
SO_REUSEPORTon sockets of address families other thanAF_INETandAF_INET6, as it is meaningless with these address families, and the call with fail with Linux kernel 6.12.9 and newer.gh-118761: Improve import time of
tomllibby removingtyping,string, andtomllib._typesimports. Patch by Taneli Hukkinen.gh-128679:
tracemalloc: Fix race conditions whentracemalloc.stop()is called by a thread, while other threads are tracing memory allocations. Patch by Victor Stinner.gh-128891: Add specialized opcodes to
opcode.opname.gh-118761: Reduce import time of
gettextby up to ten times, by importingreon demand. In particular,reis no longer implicitly exposed asgettext.re. Patch by Eli Schwartz.gh-118761: Reduce the import time of
optparsewhen no help text is printed. Patch by Eli Schwartz.gh-128657: Fix possible extra reference when using objects returned by
hashlib.sha256()under free threading.gh-118761: Reduce the import time of
csvby up to five times, by importingreon demand. In particular,reis no more implicitly exposed ascsv.re. Patch by Bénédikt Tran.gh-128308: Support the name keyword argument for eager tasks in
asyncio.loop.create_task(),asyncio.create_task()andasyncio.TaskGroup.create_task(), by passing on all kwargs to the task factory set byasyncio.loop.set_task_factory().gh-118761: Improve the performance of
base64.b16decode()by up to ten times by more efficiently checking the byte-string for hexadecimal digits. Reduce the import time ofbase64by up to six times, by no longer importingre. Patch by Bénédikt Tran, Chris Markiewicz, and Adam Turner.gh-128156: When using macOS system
libffi, support for complex types inctypesis now checked at runtime (macOS 10.15 or newer). The types must also be available at build time.gh-128636: Fix PyREPL failure when
os.environis overwritten with an invalid value.gh-128498: Default to stdout isatty for color detection instead of stderr. Patch by Hugo van Kemenade.
gh-128384: Add locking to
warningsto avoid some data races when free-threading is used. Change_warnings_runtime_state.mutexto be a recursive mutex and expose it towarnings, via the_acquire_lock()and_release_lock()functions. The lock is held whenfiltersand_filters_versionare updated.gh-128509: Add
sys._is_immortal()for identifying immortal objects at runtime.gh-128479: Fix
asyncio.staggered.staggered_race()leaking tasks and issuing an unhandled exception.gh-128427:
uuid.NILanduuid.MAXare now available to represent the Nil and Max UUID formats as defined by RFC 9562.gh-91279:
zipfile.ZipFile.writestr()now respectSOURCE_DATE_EPOCHthat distributions can set centrally and have build tools consume this in order to produce reproducible output.gh-112064: Fix incorrect handling of negative read sizes in
HTTPResponse.read. Patch by Yury Manushkin.gh-128131: Completely support random access of uncompressed unencrypted read-only zip files obtained by
ZipFile.open.gh-127975: Avoid reusing quote types in
ast.unparse()if not needed.gh-115514: Fix exceptions and incomplete writes after
asyncio._SelectorTransportis closed before writes are completed.gh-121604: Add missing Deprecation warnings for
importlib.machinery.DEBUG_BYTECODE_SUFFIXES,importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES,importlib.machinery.WindowsRegistryFinder,importlib.abc.ResourceLoader,importlib.abc.SourceLoader.path_mtime().gh-127873: When
-Eis set, only ignorePYTHON_COLORSand notFORCE_COLOR/NO_COLOR/TERMwhen colourising output. Patch by Hugo van Kemenade.gh-125413: Add
pathlib.Path.infoattribute, which stores an object implementing thepathlib.types.PathInfoprotocol (also new). The object supports querying the file type and internally cachingstat()results. Path objects generated byiterdir()are initialized with file type information gleaned from scanning the parent directory.gh-127712: Fix handling of the
secureargument oflogging.handlers.SMTPHandler.gh-127096: Do not recreate unnamed section on every read in
configparser.ConfigParser. Patch by Andrey Efremov.gh-124369: Deprecate
pdb.Pdb.curframe_localsgh-126332: Fix _pyrepl crash when entering a double CTRL-Z on an overflowing line.
gh-125553: Fix round-trip invariance for backslash continuations in
tokenize.untokenize().gh-91048: Add
asyncio.capture_call_graph()andasyncio.print_call_graph()functions.gh-124703: Quitting
pdbininlinemode will emit a confirmation prompt and exit gracefully now, instead of printing an exception traceback.gh-123987: Fixed issue in NamespaceReader where a non-path item in a namespace path, such as a sentinel added by an editable installer, would break resource loading.
gh-119349: Add the
ctypes.util.dllist()function to list the loaded shared libraries for the current process.gh-55454: Add IMAP4
IDLEsupport to theimaplibmodule. Patch by Forest.gh-119257: Show tab completions menu below the current line, which results in less janky behaviour, and fixes a cursor movement bug. Patch by Daniel Hollas
gh-101410: Support custom messages for domain errors in the
mathmodule (math.sqrt(),math.log()andmath.atanh()were modified as examples). Patch by Charlie Zhao and Sergey B Kirpichev.gh-81340: Use
os.copy_file_range()inshutil.copy(),shutil.copy2(), andshutil.copyfile()functions by default. An underlying Linux system call gives filesystems an opportunity to implement the use of copy-on-write (in case of btrfs and XFS) or server-side copy (in the case of NFS.) Patch by Illia Volochii.bpo-27307: Add attribute and item access support to
string.Formatterin auto-numbering mode, which allows format strings like ‘{.name}’ and ‘{[1]}’.
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¶
gh-125722: Require Sphinx 8.1.3 or later to build the Python documentation. Patch by Adam Turner.
gh-67206: Document that
string.printableis not printable in the POSIX sense. In particular,string.printable.isprintable()returnsFalse. Patch by Bénédikt Tran.
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_reservein the free threading build.gh-129763: Remove the internal
LLTRACEmacro (usePy_DEBUGinstead).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
MemoryErrorin 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.platformdoesn’t contain the major version anymore. It is always'freebsd', instead of'freebsd13'or'freebsd14'.
Library¶
gh-129345: Fix null pointer dereference in
syslog.openlog()when an audit hook raises an exception.
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()andPyLong_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_OPfor bitwise logical operations on compact ints.gh-128910: Undocumented and unused private C-API functions
_PyTrash_beginand_PyTrash_endare 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_EXTENDwhich 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
LINEevent 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
SyntaxWarningmessage for invalid escape sequences to clarify that such sequences will raise aSyntaxErrorin future Python releases. The new message also suggests a potential fix, i.e.,Did you mean "\\e"?.gh-126004: Fix handling of
UnicodeError.startandUnicodeError.endvalues in thecodecs.replace_errors()error handler. Patch by Bénédikt Tran.gh-126004: Fix handling of
UnicodeError.startandUnicodeError.endvalues in thecodecs.backslashreplace_errors()error handler. Patch by Bénédikt Tran.gh-126004: Fix handling of
UnicodeError.startandUnicodeError.endvalues in thecodecs.xmlcharrefreplace_errors()error handler. Patch by Bénédikt Tran.gh-127349: Fixed the error when resizing terminal in Python REPL. Patch by Semyon Moroz.
gh-125723: Fix crash with
gi_frame.f_localswhen generator frames outlive their generator. Patch by Mikhail Efimov.
Library¶
gh-126349: Add
turtle.fill(),turtle.poly()andturtle.no_animation()context managers. Patch by Marie Roald and Yngve Mardal Moe.
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¶
gh-112713: Added support for the
Partitionedcookie flag inhttp.cookies.
C API¶
gh-129533: Update
PyGC_Enable(),PyGC_Disable(),PyGC_IsEnabled()to use atomic operation for thread-safety at free-threading build. Patch by Donghee Na.gh-89188: Implement
PyUnicode_KIND()andPyUnicode_DATA()as function, in addition to the macros with the same names. The macros rely on C bit fields which have compiler-specific layout. Patch by Victor Stinner.gh-91417: Remove
PySequence_Fast()from the limited C API, since this function has to be used withPySequence_Fast_GET_ITEMwhich never worked in the limited C API. Patch by Victor Stinner.gh-128509: Add
PyUnstable_IsImmortal()for determining whether an object is immortal.gh-129033: Remove
_PyInterpreterState_GetConfigCopy()and_PyInterpreterState_SetConfig()private functions. Use insteadPyConfig_Get()andPyConfig_Set(), public C API added by PEP 741 “Python Configuration C API”. Patch by Victor Stinner.gh-129033: Remove the private
_Py_InitializeMain()function. It was a provisional API added to Python 3.8 by PEP 587. Patch by Victor Stinner.gh-128844: Add
PyUnstable_TryIncRef()andPyUnstable_EnableTryIncRef()unstable APIs. These are helpers for dealing with unowned references in a thread-safe way, particularly in the free threading build.gh-128911: Add
PyImport_ImportModuleAttr()andPyImport_ImportModuleAttrString()helper functions to import a module and get an attribute of the module. Patch by Victor Stinner.gh-128863: The following private functions are deprecated and planned for removal in Python 3.18:
_PyBytes_Join(): usePyBytes_Join()._PyDict_GetItemStringWithError(): usePyDict_GetItemStringRef()._PyDict_Pop(): usePyDict_Pop()._PyLong_Sign(): usePyLong_GetSign()._PyLong_FromDigits()and_PyLong_New(): usePyLongWriter_Create()._PyThreadState_UncheckedGet(): usePyThreadState_GetUnchecked()._PyUnicode_AsString(): usePyUnicode_AsUTF8()._Py_HashPointer(): usePy_HashPointer()._Py_fopen_obj(): usePy_fopen().
The pythoncapi-compat project can be used to get these new public functions on Python 3.13 and older.
Patch by Victor Stinner.
gh-126599: Remove some internal test APIs for the experimental JIT compiler.
gh-127925: Convert the
decimalmodule to use PEP 757 C API (export-import integers), offering some speed-up if the integer part of theDecimalinstance is small. Patch by Sergey B Kirpichev.
Build¶
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¶
gh-128731: Fix
ResourceWarninginurllib.robotparser.RobotFileParser.read().gh-71339: Add new assertion methods for
unittest:assertHasAttr(),assertNotHasAttr(),assertIsSubclass(),assertNotIsSubclass()assertStartsWith(),assertNotStartsWith(),assertEndsWith()andassertNotEndsWith().gh-118761: Improve import time of
pickleby 25% by removing an unnecessary regular expression. As such,reis no more implicitly available aspickle.re. Patch by Bénédikt Tran.gh-128661: Fixes
typing.evaluate_forward_ref()not showing deprecation whentype_paramsarg is not passed.gh-128562: Fix possible conflicts in generated
tkinterwidget names if the widget class name ends with a digit.gh-128552: Fix cyclic garbage introduced by
asyncio.loop.create_task()andasyncio.TaskGroup.create_task()holding a reference to the created task if it is eager.gh-128340: Add internal thread safe handle to be used in
asyncio.loop.call_soon_threadsafe()for thread safe cancellation.gh-128182: Fix crash when using
ctypespointers concurrently on the free threaded build.gh-128400: Only show the current thread in
faulthandleron the free threaded build to prevent races.gh-128400: Fix crash when using
faulthandler.dump_traceback()while other threads are active on the free threaded build.gh-128388: Fix
PyREPLon Windows to support more keybindings, like the Control-← and Control-→ word-skipping keybindings and those with meta (i.e. Alt), e.g. Alt-d tokill-wordor Alt-Backspacebackward-kill-word.gh-88834: Unify the instance check for
typing.Unionandtypes.UnionType:Unionnow uses the instance checks against its parameters instead of the subclass checks.gh-128302: Fix
xml.dom.xmlbuilder.DOMEntityResolver.resolveEntity(), which was broken by the Python 3.0 transition.gh-128317: Highlight today in colour in
calendar’s CLI output. Patch by Hugo van Kemenade.gh-128302: Allow
xml.dom.xmlbuilder.DOMParser.parse()to correctly handlexml.dom.xmlbuilder.DOMInputSourceinstances that only have asystemIdattribute set.gh-128151: Improve generation of
UUIDobjects version 3, 4, 5, and 8 via their dedicated functions by 30%. Patch by Bénédikt Tran.gh-128118: Improve performance of
copy.copy()by 30% via a fast path for atomic types and container types.gh-127946: Fix crash when modifying
ctypes._CFuncPtrobjects concurrently on the free threaded build.gh-128062: Revert the font of
turtledemo’s menu bar to its default value and display the shortcut keys in the correct position.gh-128014: Fix resetting the default window icon by passing
default=''to thetkintermethodwm_iconbitmap().gh-41872: Fix quick extraction of module docstrings from a file in
pydoc. It now supports docstrings with single quotes, escape sequences, raw string literals, and other Python syntax.gh-127060: Set TERM environment variable to “dumb” to disable traceback colors in IDLE, since IDLE doesn’t understand ANSI escape sequences. Patch by Victor Stinner.
gh-126742: Fix support of localized error messages reported by dlerror(3) and gdbm_strerror in
ctypesanddbm.gnufunctions respectively. Patch by Bénédikt Tran.gh-122548: Adds two new local events to sys.monitoring,
BRANCH_LEFTandBRANCH_RIGHT. This allows the two arms of the branch to be disabled independently, which should hugely improve performance of branch-level coverage tools. The old branch event,BRANCHis now deprecated.gh-127847: Fix the position when doing interleaved seeks and reads in uncompressed, unencrypted zip files returned by
zipfile.ZipFile.open().gh-127688: Add the
SCHED_DEADLINEandSCHED_NORMALconstants to theosmodule.gh-83662: Add missing
__class_getitem__method to the Python implementation offunctools.partial(), to make it compatible with the C version. This is mainly relevant for alternative Python implementations like PyPy and GraalPy, because CPython will usually use the C-implementation of that function.gh-127586:
multiprocessing.pool.Poolnow properly restores blocked signal handlers of the parent thread when creating processes via either spawn or forkserver.gh-98188: Fix an issue in
email.message.Message.get_payload()where data cannot be decoded if the Content Transfer Encoding mechanism contains trailing whitespaces or additional junk text. Patch by Hui Liu.gh-127529: Correct behavior of
asyncio.selector_events.BaseSelectorEventLoop._accept_connection()in handlingConnectionAbortedErrorin a loop. This improves performance on OpenBSD.gh-127360: When a descriptive error message cannot be provided for an
ssl.SSLError, the “unknown error” message now shows the internal error code (as retrieved byERR_get_errorand similar OpenSSL functions).gh-127196: Fix crash when dict with keys in invalid encoding were passed to several functions in
_interpretersmodule.gh-124130: Fix a bug in matching regular expression
\Bin empty input string. Now it is always the opposite of\b. To get an old behavior, use(?!\A\Z)\B. To get a new behavior in old Python versions, use(?!\b).gh-126639:
tempfile.NamedTemporaryFilewill now issue aResourceWarningwhen it is finalized by the garbage collector without being explicitly closed.gh-126624: Expose error code
XML_ERROR_NOT_STARTEDof Expat >=2.6.4 inxml.parsers.expat.errors.gh-126225:
getoptandoptparseare no longer marked as deprecated. There are legitimate reasons to use one of these modules in preference toargparse, and none of these modules are at risk of being removed from the standard library. Of the three,argparseremains the recommended default choice, unless one of the concerns noted at the top of theoptparsemodule documentation applies.gh-124761: Add
SO_REUSEPORT_LBconstant tosocketfor FreeBSD.gh-121720:
enum.EnumDictcan now be used without resorting to private API.gh-123424: Add
zipfile.ZipInfo._for_archive()setting default properties onZipInfoobjects. Patch by Bénédikt Tran and Jason R. Coombs.gh-121676: Deprecate calling the Python implementation of
functools.reduce()with afunctionorsequenceas a keyword argument. This will be forbidden in Python 3.16 in order to match the C implementation.gh-112015:
ctypes.memoryview_at()now exists to create amemoryviewobject that refers to the supplied pointer and length. This works likectypes.string_at()except it avoids a buffer copy, and is typically useful when implementing pure Python callback functions that are passed dynamically-sized buffers.gh-95371: Added support for other image formats (PNG, PGM, and PPM) to the turtle module. Patch by Shin-myoung-serp.
Core and Builtins¶
gh-128078: Fix a
SystemErrorwhen usinganext()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_DECREFand 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
PyASCIIObjectlayout to handle interned field with the atomic operation. Patch by Donghee Na.
Library¶
gh-128192: Upgrade HTTP digest authentication algorithm for
urllib.requestby supporting SHA-256 digest authentication as specified in RFC 7616.
Core and Builtins¶
gh-114203: Optimize
Py_BEGIN_CRITICAL_SECTIONfor simple recursive calls.gh-127705: Adds stackref debugging when
Py_STACKREF_DEBUGis 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 anExceptionGroup’ssplit()function, leading to a crash in some cases. Now whensplit()returns an invalid object,except*raises aTypeErrorwith the original raisedExceptionGroupobject chained to it.gh-128030: Avoid error from calling
PyModule_GetFilenameObjecton a non-module object when importing a non-existent symbol from a non-module object.
Library¶
gh-128035: Indicate through
ssl.HAS_PHAwhether thesslmodule supports TLSv1.3 post-handshake client authentication (PHA). Patch by Will Childs-Klein.
Core and Builtins¶
gh-127274: Add a new flag,
CO_METHOD, toco_flagsthat 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_prefixis the same asbase_prefixbefore falling back to searching the Python interpreter directory.gh-127970: We now use the location of the
libpythonruntime library used in the current process to determinesys.base_prefixon 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_characterswhen 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¶
gh-128400:
Py_FatalError()no longer shows all threads on the free threaded build to prevent crashes.gh-128629: Add macros
Py_PACK_VERSION()andPy_PACK_FULL_VERSION()for bit-packing Python version numbers.gh-128008: Add
PyWeakref_IsDead()function, which tests if a weak reference is dead.gh-127350: Add
Py_fopen()function to open a file. Similar to thefopen()function, but the path parameter is a Python object and an exception is set on error. Add alsoPy_fclose()function to close a file, function needed for Windows support. Patch by Victor Stinner.
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
cursesmodule on platforms with libncurses but without libncursesw.gh-90905: Add support for cross-compiling to x86_64 on aarch64/arm64 macOS.
gh-128321: Set
LIBSinstead ofLDFLAGSwhen checking ifsqlite3library functions are available. This fixes the ordering of linked libraries during checks, which was incorrect when using a statically linkedlibsqlite3.gh-100384: Error on
unguarded-availabilityin macOS builds, preventing invalid use of symbols that are not available in older versions of the OS.gh-128104: Remove
Py_STRFTIME_C99_SUPPORTconditions 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
--pystatsto the Windows build to enable performance statistics collection.
Python 3.14.0 alpha 3¶
Release date: 2024-12-17
Windows¶
Tools/Demos¶
Tests¶
gh-127906: Test the limited C API in test_cppext. Patch by Victor Stinner.
gh-127637: Add tests for the
discommand-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, andmprotectcalls from file-related ones when testingiobehavior using strace.
Security¶
gh-127655: Fixed the
asyncio.selector_events._SelectorSocketTransporttransport not pausing writes for the protocol when the buffer reaches the high water mark when usingasyncio.WriteTransport.writelines().
Library¶
gh-126907: Fix crash when using
atexitconcurrently on the free-threaded build.gh-127870: Detect recursive calls in ctypes
_as_parameter_handling. Patch by Victor Stinner.gh-127732: The
platformmodule now correctly detects Windows Server 2025.gh-126789: Fixed
sysconfig.get_config_vars(),sysconfig.get_paths(), and siblings, returning outdated cached data if the value ofsys.prefixorsys.exec_prefixchanges. Overwritingsys.prefixorsys.exec_prefixstill is discouraged, as that might break other parts of the code.gh-127718: Add colour to
test.regrtestoutput. Patch by Hugo van Kemenade.gh-127610: Added validation for more than one var-positional or var-keyword parameters in
inspect.Signature. Patch by Maxim Ageev.gh-127627: Added
posix._emscripten_debugger()to help with debugging the test suite on the Emscripten target.gh-126821: macOS and iOS apps can now choose to redirect stdout and stderr to the system log during interpreter configuration.
gh-93312: Include
<sys/pidfd.h>to getos.PIDFD_NONBLOCKconstant. Patch by Victor Stinner.gh-127481: Add the
EPOLLWAKEUPconstant to theselectmodule.gh-127065: Make
operator.methodcaller()thread-safe and re-entrant safe.gh-127321:
pdb.set_trace()will not stop at an opcode that does not have an associated line number anymore.gh-127429: Fixed bug where, on cross-builds, the
sysconfigPOSIX data was being generated with the host Python’sMakefile. The data is now generated from current build’sMakefile.gh-127413: Add the
dis --specializedcommand-line option to show specialized bytecode. Patch by Bénédikt Tran.gh-125413: Revert addition of
pathlib.Path.scandir(). This method was added in 3.14.0a2. The optimizations remain for file system paths, but other subclasses should only have to implementpathlib.Path.iterdir().gh-127257: In
ssl, system call failures that OpenSSL reports usingERR_LIB_SYSare now raised asOSError.gh-59705: On Linux,
threading.Threadnow sets the thread name to the operating system. Patch by Victor Stinner.gh-127303: Publicly expose
EXACT_TOKEN_TYPESintoken.__all__.gh-127331:
sslcan show descriptions for errors added in OpenSSL 3.4.gh-123967: Fix faulthandler for trampoline frames. If the top-most frame is a trampoline frame, skip it. Patch by Victor Stinner.
gh-127178: A
_sysconfig_vars_(...).jsonfile is now shipped in the standard library directory. It contains the output ofsysconfig.get_config_vars()on the default environment encoded as JSON data. This is an implementation detail, and may change at any time.gh-127072: Remove outdated
socket.NETLINK_*constants not present in Linux kernels beyond 2.6.17.gh-127255: The
CopyComPointer()function is now public. Previously, this was private and only available in_ctypes.gh-127182: Fix
io.StringIO.__setstate__()crash, whenNonewas passed as the first value.gh-127217: Fix
urllib.request.pathname2url()for paths starting with multiple slashes on Posix.gh-125866:
urllib.request.pathname2url()now adds an empty authority when generating a URL for a path that begins with exactly one slash. For example, the path/etc/hostsis converted to the scheme-less URL///etc/hosts. As a result of this change, URLs without authorities are only generated for relative paths.gh-127221: Add colour to
unittestoutput. Patch by Hugo van Kemenade.gh-127035: Fix
shutil.whichon Windows. Now it looks at direct match if and only if the command ends with a PATHEXT extension or X_OK is not in mode. Support extensionless files if “.” is in PATHEXT. Support PATHEXT extensions that end with a dot.gh-122273: Support PyREPL history on Windows. Patch by devdanzin and Victor Stinner.
gh-125866:
urllib.request.pathname2url()andurl2pathname()no longer convert Windows drive letters to uppercase.gh-127078: Fix issue where
urllib.request.url2pathname()failed to discard an extra slash before a UNC drive in the URL path on Windows.gh-126766: Fix issue where
urllib.request.url2pathname()failed to discard any ‘localhost’ authority present in the URL.gh-127065: Fix crash when calling a
operator.methodcaller()instance from multiple threads in the free threading build.gh-127090: Fix value of
urllib.response.addinfourl.urlforfile:URLs that express relative paths and absolute Windows paths. The canonical URL generated byurllib.request.pathname2url()is now used.gh-126992: Fix LONG and INT opcodes to only use base 10 for string to integer conversion in
pickle.gh-126997: Fix support of STRING and GLOBAL opcodes with non-ASCII arguments in
pickletools.pickletools.dis()now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX).gh-126316:
grp: Makegrp.getgrall()thread-safe by adding a mutex. Patch by Victor Stinner.gh-126618: Fix the representation of
itertools.countobjects when the count value issys.maxsize.gh-126615: The
COMErrorexception is now public. Previously, this was private and only available in_ctypes.gh-126985: When running under a virtual environment with the
sitedisabled (see-S),sys.prefixandsys.base_prefixwill now point to the virtual environment, instead of the base installation.gh-112192: In the
tracemodule, increase the coverage precision (cov%) to one decimal.gh-118761: Improve import time of
mimetypesby around 11-16 times. Patch by Hugo van Kemenade.gh-126947: Raise
TypeErrorin_pydatetime.timedelta.__new__()if the passed arguments are notintorfloat, so that the Python implementation is in line with the C implementation.gh-126946: Improve the
GetoptErrorerror message when a long option prefix matches multiple accepted options ingetopt.getopt()andgetopt.gnu_getopt().gh-126899: Make tkinter widget methods
after()andafter_idle()accept arguments passed by keyword.gh-85168: Fix issue where
urllib.request.url2pathname()andpathname2url()always used UTF-8 when quoting and unquoting file URIs. They now use the filesystem encoding and error handler.gh-126780: Fix
os.path.normpath()for drive-relative paths on Windows.gh-126775: Make
linecache.checkcache()thread safe and GC re-entrancy safe.gh-126601: Fix issue where
urllib.request.pathname2url()raisedOSErrorwhen given a Windows path containing a colon character not following a drive letter, such as before an NTFS alternate data stream.gh-126727:
locale.nl_langinfo(locale.ERA)now returns multiple era description segments separated by semicolons. Previously it only returned the first segment on platforms with Glibc.gh-118201: Fixed intermittent failures of
os.confstr,os.pathconfandos.sysconfon iOS and Android.gh-86463: The
usageparameter ofargparse.ArgumentParserno longer affects the default value of theprogparameter in subparsers.gh-124008: Fix possible crash (in debug build), incorrect output or returning incorrect value from raw binary
write()when writing to console on Windows.gh-123401: The
http.cookiesmodule now supports parsing obsolete RFC 850 date formats, in accordance with RFC 9110 requirements. Patch by Nano Zheng.gh-122431:
readline.append_history_file()now raises aValueErrorwhen given a negative value.gh-122356: Guarantee that the position of a file-like object passed to
zipfile.is_zipfile()is left untouched after the call. Patch by Bénédikt Tran.gh-122288: Improve the performances of
fnmatch.translate()by a factor 1.7. Patch by Bénédikt Tran.gh-88110: Fixed
multiprocessing.Processreporting a.exitcodeof 1 even on success when using the"fork"start method while using aconcurrent.futures.ThreadPoolExecutor.gh-97514: Authentication was added to the
multiprocessingforkserver start method control socket so that only processes with the authentication key generated by the process that spawned the forkserver can control it. This is an enhancement over the other gh-97514 fixes so that access is no longer limited only by filesystem permissions.The file descriptor exchange of control pipes with the forked worker process now requires an explicit acknowledgement byte to be sent over the socket after the exchange on all forkserver supporting platforms. That makes testing the above much easier.
Documentation¶
gh-127347: Publicly expose
traceback.print_list()intraceback.__all__.
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_Tuplenow creates the resulting tuple atomically, preventing partially created tuples being visible to the garbage collector or throughgc.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
ImportErrorfor missing symbols infromimports, use__file__in the error message if__spec__.originis not a locationgh-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
memoryviewobject 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¶
gh-127133: Calling
argparse.ArgumentParser.add_argument_group()on an argument group, and callingargparse.ArgumentParser.add_argument_group()orargparse.ArgumentParser.add_mutually_exclusive_group()on a mutually exclusive group now raise exceptions. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inheritance. This functionality has been deprecated since Python 3.11.
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(), orPyCode_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__()ofbytearraycrashing whenREADorWRITEare passed as flags.gh-126937: Fix
TypeErrorwhen actypes.Structurehas a field size that doesn’t fit into an unsigned 16-bit integer. Instead, the maximum number of bits issys.maxsize.gh-126868: Increase performance of
intby 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()tomemoryviewobjects. Patch by Bénédikt Tran.gh-125420: Add
memoryview.count()tomemoryviewobjects. 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¶
gh-127896: The previously undocumented function
PySequence_In()is soft deprecated. UsePySequence_Contains()instead.gh-127791: Fix loss of callbacks after more than one call to
PyUnstable_AtExit().gh-127691: The Unicode Exception Objects C API now raises a
TypeErrorif its exception argument is not aUnicodeErrorobject. Patch by Bénédikt Tran.gh-123378: Ensure that the value of
UnicodeEncodeError.endretrieved byPyUnicodeEncodeError_GetEnd()lies in[min(1, objlen), max(min(1, objlen), objlen)]where objlen is the length ofUnicodeEncodeError.object. Similar arguments apply toUnicodeDecodeErrorandUnicodeTranslateErrorand their corresponding C interface. Patch by Bénédikt Tran.gh-127314: Improve error message when calling the C API without an active thread state on the free-threaded build.
gh-123378: Ensure that the value of
UnicodeEncodeError.startretrieved byPyUnicodeEncodeError_GetStart()lies in[0, max(0, objlen - 1)]where objlen is the length ofUnicodeEncodeError.object. Similar arguments apply toUnicodeDecodeErrorandUnicodeTranslateErrorand their corresponding C interface. Patch by Bénédikt Tran.gh-109523: Reading text from a non-blocking stream with
readmay now raise aBlockingIOErrorif the operation cannot immediately return bytes.gh-102471: Add a new import and export API for Python
intobjects (PEP 757):Patch by Victor Stinner.
gh-121058:
PyThreadState_Clear()now warns (and callssys.excepthook) if the thread state still has an active exception.
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_examplesubfolder.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
_tkintermodule. 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
platformdue 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
SystemErrorwhensys.exit()is called with0xffffffffon 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¶
Tests¶
Security¶
gh-126623: Upgrade libexpat to 2.6.4
Library¶
gh-85957: Add missing MIME types for images with RFCs: emf, fits, g3fax, jp2, jpm, jpx, t38, tiff-fx and wmf. Patch by Hugo van Kemenade.
gh-126920: Fix the
prefixandexec_prefixkeys fromsysconfig.get_config_vars()incorrectly having the same value assys.base_prefixandsys.base_exec_prefix, respectively, inside virtual environments. They now accurately reflectsys.prefixandsys.exec_prefix.gh-67877: Fix memory leaks when
regular expressionmatching terminates abruptly, either because of a signal or because memory allocation fails.gh-125063:
marshalnow supportssliceobjects. The marshal format version was increased to 5.gh-126789: Fixed the values of
sysconfig.get_config_vars(),sysconfig.get_paths(), and their siblings when thesiteinitialization happens aftersysconfighas built a cache forsysconfig.get_config_vars().gh-126188: Update bundled pip to 24.3.1
gh-126766: Fix issue where
urllib.request.url2pathname()failed to discard two leading slashes introducing an empty authority section.gh-126705: Allow
os.PathLiketo be a base for Protocols.gh-126699: Allow
collections.abc.AsyncIteratorto be a base for Protocols.gh-126654: Fix crash when non-dict was passed to several functions in
_interpretersmodule.gh-104745: Limit starting a patcher (from
unittest.mock.patch()orunittest.mock.patch.object()) more than once without stopping itgh-126595: Fix a crash when instantiating
itertools.countwith an initial count ofsys.maxsizeon debug builds. Patch by Bénédikt Tran.gh-120423: Fix issue where
urllib.request.pathname2url()mishandled Windows paths with embedded forward slashes.gh-126565: Improve performances of
zipfile.Path.open()for non-reading modes.gh-126505: Fix bugs in compiling case-insensitive
regular expressionswith character classes containing non-BMP characters: upper-case non-BMP character did was ignored and the ASCII flag was ignored when matching a character range whose upper bound is beyond the BMP region.gh-117378: Fixed the
multiprocessing"forkserver"start method forkserver process to correctly inherit the parent’ssys.pathduring the importing ofmultiprocessing.set_forkserver_preload()modules in the same manner assys.pathis configured in workers before executing work items.This bug caused some forkserver module preloading to silently fail to preload. This manifested as a performance degradation in child processes when the
sys.pathwas required due to additional repeated work in every worker.It could also have a side effect of
""remaining insys.pathduring forkserver preload imports instead of the absolute path fromos.getcwd()at multiprocessing import time used in the workersys.path.The
sys.pathdifferences between phases in the child process could potentially have caused preload to import incorrect things from the wrong location. We are unaware of that actually having happened in practice.gh-125679: The
multiprocessing.Lockandmultiprocessing.RLockreprvalues no longer say “unknown” on macOS.gh-126476: Raise
calendar.IllegalMonthError(now a subclass ofIndexError) forcalendar.month()when the input month is not correct.gh-126489: The Python implementation of
pickleno longer callspickle.Pickler.persistent_id()for the result ofpersistent_id().gh-126451: Register the
contextvars.Contexttype tocollections.abc.Mapping.gh-126175: Add
msg,doc,pos,linenoandcolnoattributes totomllib.TOMLDecodeError. Deprecate instantiating with free-form arguments.gh-89416: Add RFC 9559 MIME types for Matroska audiovisual container formats. Patch by Hugo van Kemenade.
gh-126417: Register the
multiprocessing.managers.DictProxyandmultiprocessing.managers.ListProxytypes inmultiprocessing.managerstocollections.abc.MutableMappingandcollections.abc.MutableSequence, respectively.gh-126390: Add support for returning intermixed options and non-option arguments in order in
getopt.gnu_getopt().gh-126374: Add support for options with optional arguments in the
getoptmodule.gh-126363: Speed up pattern parsing in
pathlib.Path.glob()by skipping creation of apathlib.Pathobject for the pattern.gh-126353:
asyncio.get_event_loop()now does not implicitly creates an event loop. It now raises aRuntimeErrorif there is no set event loop. Patch by Kumar Aditya.gh-126313: Fix an issue in
curses.napms()whencurses.initscr()has not yet been called. Patch by Bénédikt Tran.gh-126303: Fix pickling and copying of
os.sched_paramobjects.gh-126138: Fix a use-after-free crash on
asyncio.Taskobjects whose underlying coroutine yields an object that implements an evil__getattribute__(). Patch by Nico Posada.gh-120057: Replace the
os.environ.refresh()method with a newos.reload_environ()function. Patch by Victor Stinner.gh-126220: Fix crash in
cProfile.Profileand_lsprof.Profilerwhen their callbacks were directly called with 0 arguments.gh-126212: Fix issue where
urllib.request.pathname2url()andurl2pathname()removed slashes from Windows DOS drive paths and URLs.gh-126223: Raise a
UnicodeEncodeErrorinstead of aSystemErrorupon calling_interpreters.create()with an invalid Unicode character.gh-126205: Fix issue where
urllib.request.pathname2url()generated URLs beginning with four slashes (rather than two) when given a Windows UNC path.gh-126156: Improved performances of creating
Morselobjects by a factor of 3.8x.gh-126105: Fix a crash in
astwhen theast.AST._fieldsattribute is deleted.gh-126106: Fixes a possible
NULLpointer dereference inssl.gh-126080: Fix a use-after-free crash on
asyncio.Taskobjects for which the underlying event loop implements an evil__getattribute__(). Reported by Nico-Posada. Patch by Bénédikt Tran.gh-125322: Correct detection of complex numbers support in libffi.
gh-126083: Fixed a reference leak in
asyncio.Taskobjects when reinitializing the same object with a non-Nonecontext. Patch by Nico Posada.gh-126068: Fix exceptions in the
argparsemodule so that only error messages for ArgumentError and ArgumentTypeError are now translated. ArgumentError is now only used for command line errors, not for logical errors in the program. TypeError is now raised instead of ValueError for some logical errors.gh-125413: Add
pathlib.Path.scandir()method to efficiently fetch directory children and their file attributes. This is a trivial wrapper ofos.scandir().gh-125984: Fix use-after-free crashes on
asyncio.Futureobjects for which the underlying event loop implements an evil__getattribute__(). Reported by Nico-Posada. Patch by Bénédikt Tran.gh-125926: Fix
urllib.parse.urljoin()for base URI with undefined authority. Although RFC 3986 only specify reference resolution for absolute base URI,urljoin()should continue to return sensible result for relative base URI.gh-125969: Fix an out-of-bounds crash when an evil
asyncio.loop.call_soon()mutates the length of the internal callbacks list. Patch by Bénédikt Tran.gh-125966: Fix a use-after-free crash in
asyncio.Future.remove_done_callback(). Patch by Bénédikt Tran.gh-125789: Fix possible crash when mutating list of callbacks returned by
asyncio.Future._callbacks. It now always returns a new copy in C implementation_asyncio. Patch by Kumar Aditya.gh-126916: Allow the initial parameter of
functools.reduce()to be passed as a keyword argument. Patch by Sayandip Dutta.gh-124452: Fix an issue in
email.policy.EmailPolicy.header_source_parse()andemail.policy.Compat32.header_source_parse()that introduced spurious leading whitespaces into header values when the header includes a newline character after the header name delimiter (:) and before the value.gh-117941:
argparse.BooleanOptionalActionnow rejects option names starting with--no-.gh-125884: Fixed the bug for
pdbwhere it can’t set breakpoints on functions with certain annotations.gh-125355: Fix several bugs in
argparse.ArgumentParser.parse_intermixed_args().The parser no longer changes temporarily during parsing.
Default values are not processed twice.
Required mutually exclusive groups containing positional arguments are now supported.
The missing arguments report now includes the names of all required optional and positional arguments.
Unknown options can be intermixed with positional arguments in parse_known_intermixed_args().
gh-125767:
superobjects are nowpickleableandcopyable.gh-124969:
locale.nl_langinfo(locale.ALT_DIGITS)now returns a string again. The returned value consists of up to 100 semicolon-separated symbols.gh-84850: Remove
URLopenerandFancyURLopenerclasses fromurllib.request. They had previously raisedDeprecationWarningsince Python 3.3.gh-125666: Avoid the exiting the interpreter if a null byte is given as input in the new REPL.
gh-125710: [Enum] fix hashable<->nonhashable comparisons for member values
gh-125631: Restore ability to set
persistent_idandpersistent_loadattributes of instances of thePicklerandUnpicklerclasses in thepicklemodule.gh-125378: Fixed the bug in
pdbwhere after a multi-line command, an empty line repeats the first line of the multi-line command, instead of the full command.gh-125682: Reject non-ASCII digits in the Python implementation of
json.loads()conforming to the JSON specification.gh-125660: Reject invalid unicode escapes for Python implementation of
json.loads().gh-52551: Use
wcsftime()to implementtime.strftime()on Windows.gh-125259: Fix the notes removal logic for errors thrown in enum initialization.
gh-125633: Add function
inspect.ispackage()to determine whether an object is a package or not.gh-125614: In the
FORWARDREFformat ofannotationlib, fix bug where nested expressions were not returned asannotationlib.ForwardRefformat.gh-125590: Allow
FrameLocalsProxyto delete and pop if the key is not a fast variable.gh-125600: Only show stale code warning in
pdbwhen we display source code.gh-125542: Deprecate passing keyword-only prefix_chars argument to
argparse.ArgumentParser.add_argument_group().gh-125541: Pressing Ctrl-C while blocked in
threading.Lock.acquire(),threading.RLock.acquire(), andthreading.Thread.join()now interrupts the function call and raises aKeyboardInterruptexception on Windows, similar to how those functions behave on macOS and Linux.gh-125519: Improve traceback if
importlib.reload()is called with an object that is not a module. Patch by Alex Waygood.gh-125451: Fix deadlock when
concurrent.futures.ProcessPoolExecutorshuts down concurrently with an error when feeding a job to a worker process.gh-125115: Fixed a bug in
pdbwhere arguments starting with-can’t be passed to the debugged script.gh-125398: Fix the conversion of the
VIRTUAL_ENVpath in the activate script invenvwhen running in Git Bash for Windows.gh-125245: Fix race condition when importing
collections.abc, which could incorrectly return an empty module.gh-52551: Fix encoding issues in
time.strftime(), thestrftime()method of thedatetimeclassesdatetime,dateandtimeand formatting of these classes. Characters not encodable in the current locale are now acceptable in the format string. Surrogate pairs and sequence of surrogatescape-encoded bytes are no longer recombinated. Embedded null character no longer terminates the format string.gh-124984: Fixed thread safety in
sslin the free-threaded build. OpenSSL operations are now protected by a per-object lock.gh-124651: Properly quote template strings in
venvactivation scripts.gh-124694: We’ve added
concurrent.futures.InterpreterPoolExecutor, which allows you to run code in multiple isolated interpreters. This allows you to circumvent the limitations of CPU-bound threads (due to the GIL). Patch by Eric Snow.This addition is unrelated to PEP 734.
gh-58032: Deprecate the
argparse.FileTypetype converter.gh-99749: Adds a feature to optionally enable suggestions for argument choices and subparser names if mistyped by the user.
gh-58956: Fixed a bug in
pdbwhere sometimes the breakpoint won’t trigger if it was set on a function which is already in the call stack.gh-124111: The tkinter module can now be built to use either the new version 9.0.0 of Tcl/Tk or the latest release 8.6.15 of Tcl/Tk 8. Tcl/Tk 9 includes many improvements, both to the Tcl language and to the appearance and utility of the graphical user interface provided by Tk.
gh-80958: unittest discovery supports PEP 420 namespace packages as start directory again.
gh-123370: Fix the canvas not clearing after running turtledemo clock.
gh-89083: Add
uuid.uuid8()for generating UUIDv8 objects as specified in RFC 9562. Patch by Bénédikt Trangh-122549: Add
platform.invalidate_caches()to invalidate cached results.gh-120754: Update unbounded
readcalls inzipfileto specify an explicitsizeputting a limit on how much data they may read. This also updates handling around ZIP max comment size to match the standard instead of reading comments that are one byte too long.gh-121267: Improve the performance of
tarfilewhen writing files, by caching user names and group names.gh-70764: Fixed an issue where
inspect.getclosurevars()would incorrectly classify an attribute name as a global variable when the name exists both as an attribute name and a global variable.gh-118289:
posixpath.realpath()now raisesNotADirectoryErrorwhen strict mode is enabled and a non-directory path with a trailing slash is supplied.gh-119826: Always return an absolute path for
os.path.abspath()on Windows.gh-97850: Remove deprecated
pkgutil.get_loader()andpkgutil.find_loader().gh-118986: Add
socket.IPV6_RECVERRconstant (available since Linux 2.2).gh-116897: Accepting objects with false values (like
0and[]) except empty strings, byte-like objects andNoneinurllib.parsefunctionsparse_qsl()andparse_qs()is now deprecated.gh-101955: Fix SystemError when match regular expression pattern containing some combination of possessive quantifier, alternative and capture group.
gh-71936: Fix a race condition in
multiprocessing.pool.Pool.bpo-46128: Strip
unittest.IsolatedAsyncioTestCasestack frames from reported stacktraces.gh-84852: Add MIME types for MS Embedded OpenType, OpenType Layout, TrueType, WOFF 1.0 and 2.0 fonts. Patch by Sahil Prajapati and Hugo van Kemenade.
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
objecttype 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
ValueErroris raised instead ofSystemErrorwhen trying to iterate over a releasedmemoryviewobject.gh-126688: Fix a crash when calling
os.fork()on some operating systems, including SerenityOS.
Library¶
Core and Builtins¶
Library¶
gh-126209: Fix an issue with
skip_file_prefixesparameter which resulted in an inconsistent behaviour between the C and Python implementations ofwarnings.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
Noneto itsco_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_flagsto indicate whether the first item inco_constsis the docstring. If a code object has no docstring,Nonewill NOT be inserted.gh-126076: Relocated objects such as
tuple,bytesandstrobjects are properly tracked bytracemallocand 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
memoryviewtype now supports subscription, making it a generic type.gh-125837: Adds
LOAD_SMALL_INTandLOAD_CONST_IMMORTALinstructions.LOAD_SMALL_INTpushes a small integer equal to theopargto the stack.LOAD_CONST_IMMORTALdoes the same asLOAD_CONSTbut is more efficient for immortal objects. RemovesRETURN_CONSTinstruction.gh-125942: On Android, the
errorssetting ofsys.stdoutwas changed fromsurrogateescapetobackslashreplace.gh-125859: Fix a crash in the free threading build when
gc.get_objects()orgc.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_noneattribute, which supports more platforms and is more useful than LLVM’s existingghccccalling convention. This also removes the need to manually patch the calling convention in LLVM IR, simplifying the JIT compilation process.gh-125703: Correctly honour
tracemallochooks in specializedPy_DECREFpaths. Patch by Pablo Galindogh-125593: Use color to highlight error locations in traceback from exception group
gh-125017: Fix crash on certain accesses to the
__annotations__ofstaticmethodandclassmethodobjects.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_SIZEmacro 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
ImportErrorto 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 likezip()to check that all the iterables are of equal length. Patch by Wannes Boeykens.
Library¶
C API¶
gh-126554: Fix error handling in
ctypes.CDLLobjects which could result in a crash in rare situations.gh-126061: Add
PyLong_IsPositive(),PyLong_IsNegative()andPyLong_IsZero()for checking if aPyLongObjectis positive, negative, or zero, respectively.gh-125608: Fix a bug where dictionary watchers (e.g.,
PyDict_Watch()) on an object’s attribute dictionary (__dict__) were not triggered when the object’s attributes were modified.gh-123619: Added the
PyUnstable_Object_EnableDeferredRefcount()function for enabling PEP 703 deferred reference counting.gh-121654: Add
PyType_Freeze()function to make a type immutable. Patch by Victor Stinner.gh-120026: The
Py_HUGE_VALmacro is soft deprecated.
Build¶
gh-126691: Removed the
--with-emscripten-targetconfigure flag. We unified thenodeandbrowseroptions and the same build can now be used, independent of target runtime.gh-123877: Use
wasm32-wasip1as the target triple for WASI instead ofwasm32-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 clinicnow runs Argument Clinic using the--forceoption, thus forcefully regenerating generated code.gh-126187: Introduced
Tools/wasm/emscripten.pyto simplify doing Emscripten builds.gh-124932: For cross builds, there is now support for having a different install
prefixthan thehost_prefixused bygetpath.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¶
Windows¶
gh-124487: Increases Windows required OS and API level to Windows 10.
gh-124609: Fix
_Py_ThreadIdfor 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.batuses 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_QUICKACKon Windows platforms.gh-122573: The Windows build of CPython now requires 3.10 or newer.
gh-100256:
mimetypesno 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.exehandling of shebangs like/usr/bin/env python3.12, which were previously interpreted aspython3.exeinstead ofpython3.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
mmapon 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
zlibon 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_ttkto pass with Tcl/Tk 8.6.15.gh-124213: Detect whether the test suite is running inside a systemd-nspawn container with
--suppress-sync=trueoption, and skip thetest_osandtest_mmaptests 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.pyso 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 throwOSErrorwhen 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 (
-Roption): 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()oftest_posixpath. Callgetpwnam()to getpw_dir, since it can be different thangetpwall()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-processcommand 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_gdbif 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.pathwhen 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.IPv6Addressto consistently use the mapped IPv4 address value for deciding properties. Properties which have their behavior fixed areis_multicast,is_reserved,is_link_local,is_global, andis_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 whereAF_UNIXis 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 forpython -m asyncio. The events in question arecpython.run_stdinandcpython.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 of0o700to restrict the new directory to the current user. This fixes CVE 2024-4030 affectingtempfile.mkdtemp()in scenarios where the base temporary directory is more permissive than the default.
Library¶
gh-125422: Fixed the bug where
pdbandbdbcan step into the bottom caller frame.gh-100141: Fixed the bug where
pdbwill be stuck in an infinite loop when debugging an empty file.gh-53203: Fix
time.strptime()for%c,%xand%Xformats in many locales that use non-ASCII digits, like Persian, Burmese, Odia and Shan.gh-125206: Workaround for old libffi versions is added. Module ctypes supports double complex only with libffi >= 3.3.0. Patch by Mikhail Efimov.
gh-89967: Make
WeakKeyDictionaryandWeakValueDictionarysafe against concurrent mutations from other threads. Patch by Kumar Aditya.gh-125260: The
gzip.compress()mtime parameter now defaults to 0 for reproducible output. Patch by Bernhard M. Wiedemann and Adam Turner.gh-125243: Fix data race when creating
zoneinfo.ZoneInfoobjects in the free threading build.gh-125254: Fix a bug where ArgumentError includes the incorrect ambiguous option in
argparse.gh-125235: Keep
tkinterTCL paths in venv pointing to base installation on Windows.gh-61011: Fix inheritance of nested mutually exclusive groups from parent parser in
argparse.ArgumentParser. Previously, all nested mutually exclusive groups lost their connection to the group containing them and were displayed as belonging directly to the parser.gh-125118: Don’t copy arbitrary values to _Bool in the
structmodule.gh-125069: Fix an issue where providing a
pathlib.PurePathobject as an initializer argument to a secondPurePathobject with a differentparserresulted in arguments to the former object’s initializer being joined by the latter object’s parser.gh-125096: If the
PYTHON_BASIC_REPLenvironment variable is set, thesitemodule no longer imports the_pyreplmodule. Moreover, thesitemodule now respects-Eand-Icommand line options: ignorePYTHON_BASIC_REPLin this case. Patch by Victor Stinner.gh-124969: Fix
locale.nl_langinfo(locale.ALT_DIGITS). Now it returns a tuple of up to 100 strings (an empty tuple on most locales). Previously it returned the first item of that tuple or an empty string.gh-124960: Fix support for the
barry_as_FLUFLfuture flag in the new REPL.gh-69998: Fix
locale.nl_langinfo()in case when different categories have different locales. The function now sets temporarily theLC_CTYPElocale in some cases. This temporary change affects other threads.gh-124958: Fix refcycles in exceptions raised from
asyncio.TaskGroupand the python implementation ofasyncio.Futuregh-53203: Fix
time.strptime()for%cand%xformats in many locales: Arabic, Bislama, Breton, Bodo, Kashubian, Chuvash, Estonian, French, Irish, Ge’ez, Gurajati, Manx Gaelic, Hebrew, Hindi, Chhattisgarhi, Haitian Kreyol, Japanese, Kannada, Korean, Marathi, Malay, Norwegian, Nynorsk, Punjabi, Rajasthani, Tok Pisin, Yoruba, Yue Chinese, Yau/Nungon and Chinese.gh-123961: Convert
cursesto multi-phase initialization (PEP 489), thereby fixing reference leaks at interpreter shutdown. Patch by Bénédikt Tran.gh-117151: The default buffer size used by
shutil.copyfileobj()has been increased from 64k to 256k on non-Windows platforms. It was already larger on Windows.gh-90102: Skip the
isattysystem call during open() when the file is known to not be a character device. This provides a slight performance improvement when reading whole files.gh-124917: Allow calling
os.path.exists()andos.path.lexists()with keyword arguments on Windows. Fixes a regression in 3.13.0.gh-65865:
argparsenow raises early error for invalidhelparguments toadd_argument(),add_subparsers()andadd_parser().gh-124653: Fix detection of the minimal Queue API needed by the
loggingmodule. Patch by Bénédikt Tran.gh-91818: The CLI of many modules (
ast,ensurepip,json,pdb,sqlite3,tokenize,venv) now uses the actual executable name instead of simply “python” to display in the usage message.gh-124858: Fix reference cycles left in tracebacks in
asyncio.open_connection()when used withhappy_eyeballs_delaygh-124390: Fixed
AssertionErrorwhen usingasyncio.staggered.staggered_race()withasyncio.eager_task_factory.gh-85935:
argparse.ArgumentParser.add_argument()now raises an exception if an action that does not consume arguments (like ‘store_const’ or ‘store_true’) or explicitnargs=0are specified for positional arguments.gh-124835: Make
tomllib.loads()raiseTypeErrornotAttributeErroron bad input types that do not have thereplaceattribute. Improve error message whenbytesis received.gh-124693: Fix a bug where
argparsedoesn’t recognize negative complex numbers or negative numbers using scientific notation.gh-124787: Fix
typing.TypeAliasTypewith incorrecttype_paramsargument. Now it raises aTypeErrorwhen a type parameter without a default follows one with a default, and when an entry in thetype_paramstuple is not a type parameter object.gh-66436: Improved prog default value for
argparse.ArgumentParser. It will now include the name of the Python executable along with the module or package name, or the path to a directory, ZIP file, or directory within a ZIP file if the code was run that way.gh-116850: Fix
argparsefor namespaces with not directly writable dict (e.g. classes).gh-101552: Add an annoation_format parameter to
inspect.signature(). Add an quote_annotation_strings parameter toinspect.Signature.format(). Use the new functionality to improve the display of annotations in signatures inpydoc. Patch by Jelle Zijlstra.gh-58573: Fix conflicts between abbreviated long options in the parent parser and subparsers in
argparse.gh-124594: All
asyncioREPL prompts run in the samecontext. Contributed by Bartosz Sławecki.gh-61181: Fix support of choices with string value in
argparse. Substrings of the specified string no longer considered valid values.gh-116750: Provide
sys.monitoring.clear_tool_id()to unregister all events and callbacks set by the tool.gh-124552: Improve the accuracy of
bdb’s check for the possibility of breakpoint in a frame. This makes it possible to disable unnecessary events in functions.gh-124538: Fixed crash when using
gc.get_referents()on a capsule object.gh-80259: Fix
argparsesupport of positional arguments withnargs='?',default=argparse.SUPPRESSand specifiedtype.gh-120378: Fix a crash related to an integer overflow in
curses.resizeterm()andcurses.resize_term().gh-124498: Fix
typing.TypeAliasTypenot to be generic, whentype_paramsis an empty tuple.gh-53834: Fix support of arguments with choices in
argparse. Positional arguments with nargs equal to'?'or'*'no longer check default againstchoices. Optional arguments withnargsequal to'?'no longer check const againstchoices.gh-123884: Fixed bug in itertools.tee() handling of other tee inputs (a tee in a tee). The output now has the promised n independent new iterators. Formerly, the first iterator was identical (not independent) to the input iterator. This would sometimes give surprising results.
gh-123017: Due to unreliable results on some devices,
time.strftime()no longer accepts negative years on Android.gh-123014:
os.pidfd_open()andsignal.pidfd_send_signal()are now unavailable when building against Android API levels older than 31, since the underlying system calls may cause a crash.gh-124176: Add support for
dataclasses.dataclass()inunittest.mock.create_autospec(). Nowcreate_autospecwill check for potential dataclasses and usedataclasses.fields()function to retrieve the spec information.gh-124345:
argparsesupports abbreviated single-dash long options separated by=from its value.gh-124400: Fixed a
pdbbug whereuntilhas no effect when it appears in acommandssequence. Also avoid printing the frame information at a breakpoint that has a command list containing a command that resumes execution.gh-90562: Modify dataclasses to support zero-argument super() when
slots=Trueis specified. This works by modifying all references to__class__to point to the newly created class.gh-104860: Fix disallowing abbreviation of single-dash long options in
argparsewithallow_abbrev=False.gh-63143: Fix parsing mutually exclusive arguments in
argparse. Arguments with the value identical to the default value (e.g. booleans, small integers, empty or 1-character strings) are no longer considered “not present”.gh-72795: Positional arguments with nargs equal to
'*'orargparse.REMAINDERare no longer required. This allows to use positional argument withnargs='*'and withoutdefaultin mutually exclusive group and improves error message about required arguments.gh-59317: Fix parsing positional argument with nargs equal to
'?'or'*'if it is preceded by an option and another positional argument.gh-100980: The
_fields_attribute ofctypes.StructureandUnionis no longer set if the setattr operation raises an error.gh-53780:
argparsenow ignores the first"--"(double dash) between an option and command.gh-124217: Add RFC 9637 reserved IPv6 block
3fff::/20inipaddressmodule.gh-111513: Improve the error message that may be raised by
datetime.date.fromtimestamp().gh-124248: Fixed potential crash when using
structto process zero-width ‘Pascal string’ fields (0p).gh-81691: Fix handling of multiple
"--"(double dashes) inargparse. Only the first one has now been removed, all subsequent ones are now taken literally.gh-87041: Fix a bug in
argparsewhere lengthy subparser argument help is incorrectly indented.gh-84559: The default
multiprocessingstart method on Linux and other POSIX systems has been changed away from often unsafe"fork"to"forkserver"(when the platform supports sending file handles over pipes as most do) or"spawn". Mac and Windows are unchanged as they already default to"spawn".gh-124212: Fix invalid variable in
venvhandling of failed symlink on Windowsgh-124171: Add workaround for broken
fmod()implementations on Windows, that loose zero sign (e.g.fmod(-10, 1)returns0.0). Patch by Sergey B Kirpichev.gh-123978: Remove broken
time.thread_time()andtime.thread_time_ns()on NetBSD.gh-123934: Fix
unittest.mock.MagicMockresetting magic methods return values after.reset_mock(return_value=True)was called.gh-124016: Update
unicodedatadatabase to Unicode 16.0.0.gh-123968: Fix the command-line interface for the
randommodule to select floats between 0 and N, not 1 and N.gh-123945: Fix a bug where
argparsedoesn’t recognize negative numbers with underscoresgh-123935: Fix parent slots detection for dataclasses that inherit from classes with
__dictoffset__.gh-123892: Add
"_wmi"tosys.stdlib_module_names. Patch by Victor Stinner.gh-84808: Fix error handling in
socketmethodconnect_ex()on platforms whereerrnocan be negative.gh-123756: Added a new argument
modetopdb.Pdb. Only allowpdbfrom command line to userestartcommand.gh-122765: Fix unbalanced quote errors occurring when activate.csh in
venvwas sourced with a custom prompt containing unpaired quotes or newlines.gh-123657: Fix crash and memory leak in
decimal.getcontext(). It crashed when using a thread-local context by--with-decimal-contextvar=no.gh-123339: Fix
inspect.getsource()for classes incollections.abcanddecimal(for pure Python implementation) modules.inspect.getcomments()now raises OSError instead of IndexError if the__firstlineno__value for a class is out of bound.gh-123374: Remove check for redefined memo entry in
pickletools.dis().gh-123504: Fixed reference leak in the finalization of
tkinter.gh-123430: Pages generated by the
http.servermodule allow the browser to apply its default dark mode.gh-123446: Fix empty function name in
TypeErrorwhencsv.reader(),csv.writer(), orcsv.register_dialect()are used without the required args.gh-123448: Fixed memory leak of
typing.NoDefaultby moving it to the static types array.gh-123409: Fix
ipaddress.IPv6Address.reverse_pointeroutput according to RFC 3596, §2.5. Patch by Bénédikt Tran.gh-123089: Make
weakref.WeakSetsafe against concurrent mutations while it is being iterated. Patch by Kumar Aditya.gh-123363: Show string value of
CONTAINS_OPoparg indisoutput. Patch by Alexandr153.gh-123341: Add
__class_getitem__()totkinter.Eventfor type subscript support at runtime. Patch by Adonis Rakateli.gh-119518: Speed up normalization of
pathlib.PurePathandPathobjects by not interning string parts.gh-123270: Applied a more surgical fix for malformed payloads in
zipfile.Pathcausing infinite loops (gh-122905) without breaking contents using legitimate characters.gh-73991: Add
pathlib.Path.copy_into()andmove_into(), which copy and move files and directories into existing directories.gh-123228: Fix return type for
_pyrepl.readline._ReadlineWrapper.get_line_buffer()to bestr(). Patch by Sergey B Kirpichev.gh-123240: Raise audit events for the
input()in the new REPL.gh-76960: Fix
urllib.parse.urljoin()andurllib.parse.urldefrag()for URIs containing empty components. For example,urljoin()with relative reference “?” now sets empty query and removes fragment. Preserve empty components (authority, params, query, fragment) inurljoin(). Preserve empty components (authority, params, query) inurldefrag().gh-116810: Resolve a memory leak introduced in CPython 3.10’s
sslwhen thessl.SSLSocket.sessionproperty was accessed. Speeds up read and write access to said property by no longer unnecessarily cloning session objects via serialization.gh-123243: Fix memory leak in
_decimal.gh-122546: Consistently use same file name for different exceptions in the new repl. Patch by Sergey B Kirpichev.
gh-123213:
xml.etree.ElementTree.Element.extend()andElementassignment no longer hide the internal exception if an erroneous generator is passed. Patch by Bar Harel.gh-85110: Preserve relative path in URL without netloc in
urllib.parse.urlunsplit()andurllib.parse.urlunparse().gh-122909: In urllib.request when URLError is raised opening an ftp URL, the exception argument is now consistently a string. Earlier versions passed either a string or an ftplib exception instance as the argument to URLError.
gh-123084: Deprecate
shutil.ExecError, which hasn’t been raised by anyshutilfunction since Python 3.4. It’s now an alias forRuntimeError.gh-123085: In a bare call to
importlib.resources.files(), ensure the caller’s frame is properly detected whenimportlib.resourcesis itself available as a compiled module only (no source).gh-123067: Fix quadratic complexity in parsing
"-quoted cookie values with backslashes byhttp.cookies.gh-123049: Add support for
UNNAMED_SECTIONinconfigparser.ConfigParser.add_section().gh-121735: When working with zip archives, importlib.resources now properly honors module-adjacent references (e.g.
files(pkg.mod)and not justfiles(pkg)).gh-122981: Fix
inspect.getsource()for generated classes with Python base classes (e.g. enums).gh-122903:
zipfile.Path.globnow correctly matches directories instead of silently omitting them.gh-122905:
zipfile.Pathobjects now sanitize names from the zipfile.gh-122873: Enable
jsonmodule to work as a script using the-mswitch:python -m json. See the JSON command-line interface documentation. Patch by Trey Hunner.gh-122858: Deprecate
asyncio.iscoroutinefunction()in favor ofinspect.iscoroutinefunction().gh-116263:
logging.handlers.RotatingFileHandlerno longer rolls over empty log files.gh-105376: Restore the deprecated
loggingwarn()method. It was removed in Python 3.13 alpha 1. Keep the deprecatedwarn()method in Python 3.13. Patch by Victor Stinner.gh-122311: Improve errors in the
picklemodule.PicklingErroris now raised more often instead ofUnicodeEncodeError,ValueErrorandAttributeError, and the original exception is chained to it. Improve and unify error messages in Python and C implementations.gh-122744: Bump the version of pip bundled in ensurepip to version 24.2.
gh-118761: Improve import time of
pprintby around seven times. Patch by Hugo van Kemenade.gh-118974: Add
decoratorparameter todataclasses.make_dataclass()to customize the functional creation of dataclasses.gh-118814: Fix the
typing.TypeVarconstructor when name is passed by keyword.gh-122637: Adjust
cmath.tanh(nanj)andcmath.tanh(infj)for recent C standards.gh-122478: Remove internal frames from tracebacks shown in
code.InteractiveInterpreterwith non-defaultsys.excepthook(). Save correct tracebacks insys.last_tracebackand update__traceback__attribute ofsys.last_valueandsys.last_exc.gh-116622: On Android, the
FICLONEandFICLONERANGEconstants are no longer exposed byfcntl, as these ioctls are blocked by SELinux.gh-82378: Make sure that the new REPL interprets
sys.tracebacklimitin the same way that the classic REPL did.gh-122334: Fix crash when importing
sslafter the main interpreter restarts.gh-122459: Optimize
picklingby name objects without the__module__attribute.gh-87320: In
code.InteractiveInterpreter, handle exceptions caused by calling a non-defaultsys.excepthook(). Before, the exception bubbled up to the caller, ending the REPL.gh-122272: On some platforms such as Linux, year with century was not 0-padded when formatted by
strftime()with C99-specific specifiers'%C'or'%F'. The 0-padding behavior is now guaranteed when the format specifiers'%C'and'%F'are supported by the C library. Patch by Ben Hsinggh-122400: Handle
ValueErrors raised byos.stat()infilecmp.dircmpandfilecmp.cmpfiles(). Patch by Bénédikt Tran.gh-121650:
emailheaders with embedded newlines are now quoted on output. Thegeneratorwill now refuse to serialize (write) headers that are unsafely folded or delimited; seeverify_generated_headers. (Contributed by Bas Bloemsaat and Petr Viktorin in gh-121650.)gh-122332: Fixed segfault with
asyncio.Task.get_coro()when using an eager task factory.gh-105733:
ctypes.ARRAY()is now soft deprecated: it no longer emits deprecation warnings and is not scheduled for removal.gh-122213: Add notes for pickle serialization errors that allow to identify the source of the error.
gh-119180: As part of PEP 749, add the following attributes for customizing evaluation of annotation scopes:
evaluate_valueontyping.TypeAliasTypeevaluate_bound,evaluate_constraints, andevaluate_defaultontyping.TypeVarevaluate_defaultontyping.ParamSpecevaluate_defaultontyping.TypeVarTuple
gh-119180: Fix handling of classes with custom metaclasses in
annotationlib.get_annotations.gh-122170: Handle
ValueErrors raised byos.stat()inlinecache. Patch by Bénédikt Tran.gh-122163: Add notes for JSON serialization errors that allow to identify the source of the error.
gh-122129: Improve support of method descriptors and wrappers in the help title.
gh-122145: Fix an issue when reporting tracebacks corresponding to Python code emitting an empty AST body. Patch by Nikita Sobolev and Bénédikt Tran.
gh-121723: Make
logging.config.dictConfig()accept any object implementing the Queue public API. See the queue configuration section for details. Patch by Bénédikt Tran.gh-82951: Serializing objects with complex
__qualname__(such as unbound methods and nested classes) by name no longer involves serializing parent objects by value in pickle protocols < 4.gh-120754:
Pathlib.read_bytesno longer opens the file in Python’s buffered I/O mode. This reduces overheads as the code reads a file in whole leading to a modest speedup.gh-113785:
csvnow correctly parses numeric fields (when used withcsv.QUOTE_NONNUMERICorcsv.QUOTE_STRINGS) which start with an escape character.gh-122088:
@warnings.deprecatednow copies the coroutine status of functions and methods so thatinspect.iscoroutinefunction()returns the correct result.gh-122081: Fix a crash in the
decimal.IEEEContext()optional function available via theEXTRA_FUNCTIONALITYconfiguration flag.gh-73991: Add
pathlib.Path.move(), which moves a file or directory tree.gh-121268: Remove workarounds for non-IEEE 754 systems in
cmath.gh-119698: Due to the lack of interest for
symtable.Class.get_methods(), the method is marked as deprecated and will be removed in Python 3.16. Patch by Bénédikt Tran.gh-121889: Adjusts
cmath.acosh(complex('0+nanj'))for recent C standards.gh-121804: Correctly show error locations, when
SyntaxErrorraised in new repl. Patch by Sergey B Kirpichev.gh-121797: Add alternative
FractionconstructorFraction.from_number().gh-121798: Add alternative
DecimalconstructorDecimal.from_number().gh-120930: Fixed a bug introduced by gh-92081 that added an incorrect extra blank to encoded words occurring in wrapped headers.
gh-57141: The shallow argument to
filecmp.dircmp(new in Python 3.13) is now keyword-only.gh-121245: Simplify handling of the history file in
site.register_readline()helper. TheCAN_USE_PYREPLvariable now will be initialized, when imported. Patch by Sergey B Kirpichev.gh-121249: Support the float complex and double complex C types in the
structmodule if the compiler has C11 complex arithmetic. Patch by Sergey B Kirpichev.gh-121486:
mathfunctionsisqrt(),log(),log2()andlog10()now support integers larger than2**2**32on 32-bit platforms.gh-121474: Fix missing sanity check for
partiesarg inthreading.Barrierconstructor. Patch by Clinton Christian (pygeek).gh-121450: Hard-coded breakpoints (
breakpoint()andpdb.set_trace()) now reuse the most recentPdbinstance that callsPdb.set_trace(), instead of creating a new one each time. As a result, all the instance specific data likedisplayandcommandsare preserved across Hard-coded breakpoints.gh-119169: Slightly speed up
os.walk()by simplifying exception handling.gh-121423: Improve import time of
socketby lazy importing modules and writingsocket.errorTabas a constant.gh-59110:
zipimportsupports now namespace packages when no directory entry exists.gh-119004: Fix a crash in OrderedDict.__eq__ when operands are mutated during the check. Patch by Bénédikt Tran.
gh-121313: Limit the reading size in the
multiprocessing.connection.Connectionclass to 64 KiB to prevent memory overallocation and unnecessary memory management system calls.gh-121332: Fix constructor of
astnodes with custom_attributes. Previously, passing custom attributes would raise aDeprecationWarning. Passing arguments to the constructor that are not in_fieldsor_attributesremains deprecated. Patch by Jelle Zijlstra.gh-121245: Fix a bug in the handling of the command history of the new REPL that caused the history file to be wiped at REPL exit.
gh-121210: Handle AST nodes with missing runtime fields or attributes in
ast.compare(). Patch by Bénédikt Tran.gh-121163: Add support for
allas an validactionforwarnings.simplefilter()andwarnings.filterwarnings().gh-121151: Fix wrapping of long usage text of arguments inside a mutually exclusive group in
argparse.gh-121141: Add support for
copy.replace()to AST nodes. Patch by Bénédikt Tran.gh-87744: Fix waitpid race while calling
send_signal()in asyncio. Patch by Kumar Aditya.gh-121027: Add a future warning in
functools.partial.__get__(). In future Python versionsfunctools.partialwill be a method descriptor.gh-121027: Make the
functools.partialobject a method descriptor.gh-117784: CPython now detects whether its linked TLS library supports TLSv1.3 post-handshake authentication and disables that feature if support is lacking.
gh-121025: Improve the
__repr__()offunctools.partialmethod. Patch by Bénédikt Tran.gh-121018: Fixed issues where
argparse.ArgumentParser.parse_args()did not honorexit_on_error=False. Based on patch by Ben Hsing.gh-119614: Fix truncation of strings with embedded null characters in some internal operations in
tkinter.gh-120910: When reading installed files from an egg, use
relative_to(walk_up=True)to honor files installed outside of the installation root.gh-61103: Support float complex, double complex and long double complex C types in
ctypesasc_float_complex,c_double_complexandc_longdouble_complexif the compiler has C11 complex arithmetic. Patch by Sergey B Kirpichev.gh-120888: Upgrade pip wheel bundled with ensurepip (pip 24.1.1)
gh-101830: Accessing the
tkinterobject’s string representation no longer converts the underlying Tcl object to a string on Windows.gh-120678: Fix regression in the new REPL that meant that globals from files passed using the
-iargument would not be included in the REPL’s global namespace. Patch by Alex Waygood.gh-120811: Fix possible memory leak in
contextvars.Context.run().gh-120782: Fix wrong references of the
datetimetypes after reloading the module.gh-120713:
datetime.datetime.strftime()now 0-pads years with less than four digits for the format specifiers%Yand%Gon Linux. Patch by Ben Hsinggh-120769: Make empty line in
pdbrepeats the last command even when the command is fromcmdqueue.gh-120780: Show string value of LOAD_SPECIAL oparg in
disoutput.gh-41431: Add
datetime.time.strptime()anddatetime.date.strptime(). Contributed by Wannes Boeykens.gh-120743: Soft deprecate
os.popen()andos.spawn*functions. They should no longer be used to write new code. Thesubprocessmodule is recommended instead. Patch by Victor Stinner.gh-120732: Fix
namepassing tounittest.mock.Mockobject when usingunittest.mock.create_autospec().gh-111259:
renow handles patterns like"[\s\S]"or"\s|\S"which match any character as effectively as a dot with theDOTALLmodifier ("(?s:.)").gh-120683: Fix an error in
logging.LogRecord, when the integer part of the timestamp is rounded up, while the millisecond calculation truncates, causing the log timestamp to be wrong by up to 999 ms (affected roughly 1 in 8 million timestamps).gh-118710:
ipaddress.IPv4Addressandipaddress.IPv6Addressattributesversionandmax_prefixlenare now available on the class.gh-120633: Move scrollbar and remove tear-off menus in turtledemo.
gh-120606: Allow users to use EOF to exit
commandsdefinition inpdbgh-120284: Allow
asyncio.Runner.run()to accept awaitable objects instead of simply coroutines.gh-120541: Improve the prompt in the “less” pager when
help()is called with non-string argument.gh-120495: Fix incorrect exception handling in Tab Nanny. Patch by Wulian233.
gh-120388: Improve a warning message when a test method in
unittestreturns something other thanNone. Now we show the returned object type and optional asyncio-related tip.gh-120381: Correct
inspect.ismethoddescriptor()to check also for the lack of__delete__(). Patch by Jan Kaliszewski.gh-90425: The OS byte in gzip headers is now always set to 255 when using
gzip.compress().gh-120343: Fix column offset reporting for tokens that come after multiline f-strings in the
tokenizemodule.gh-119180: As part of implementing PEP 649 and PEP 749, add a new module
annotationlib. Add support for unresolved forward references in annotations todataclasses,typing.TypedDict, andtyping.NamedTuple.gh-119600: Fix
unittest.mock.patch()to not read attributes of the target whennew_callableis set. Patch by Robert Collins.gh-120289: Fixed the use-after-free issue in
cProfileby disallowingdisable()andclear()in external timers.gh-82017: Added support for converting any objects that have the
as_integer_ratio()method to aFraction.gh-114053: Fix edge-case bug where
typing.get_type_hints()would produce incorrect results if type parameters in a class scope were overridden by assignments in a class scope andfrom __future__ import annotationssemantics were enabled. Patch by Alex Waygood.gh-114053: Fix erroneous
NameErrorwhen callinginspect.get_annotations()witheval_str=True`on a class that made use of PEP 695 type parameters in a module that hadfrom __future__ import annotationsat the top of the file. Patch by Alex Waygood.gh-120268: Prohibit passing
Noneto pure-Pythondatetime.date.fromtimestamp()to achieve consistency with C-extension implementation.gh-120244: Fix memory leak in
re.sub()when the replacement string contains backreferences.gh-120254: Added
commandsargument topdb.set_trace()which allows users to send debugger commands from the source file.gh-120211: Fix
tkinter.ttkwith Tcl/Tk 9.0.gh-71587: Fix crash in C version of
datetime.datetime.strptime()when called again on the restarted interpreter.gh-117983: Defer the
threadingimport inimportlib.utiluntil lazy loading is used.gh-120157: Remove unused constant
concurrent.futures._base._FUTURE_STATESinconcurrent.futures. Patch by Clinton Christian (pygeek).gh-120161:
datetimeno longer crashes in certain complex reference cycle situations.gh-119698: Fix
symtable.Class.get_methods()and document its behaviour. Patch by Bénédikt Tran.gh-120121: Add
concurrent.futures.InvalidStateErrorto module’s__all__.gh-119933: Add the
symtable.SymbolTableTypeenumeration to represent the possible outputs of thesymtable.SymbolTable.get_typemethod. Patch by Bénédikt Tran.gh-120029: Expose
symtable.Symbolmethodsis_free_class(),is_comp_iter()andis_comp_cell(). Patch by Bénédikt Tran.gh-120108: Fix calling
copy.deepcopy()onasttrees that have been modified to have references to parent nodes. Patch by Jelle Zijlstra.gh-120056: Add
socket.IP_RECVERRandsocket.IP_RECVTTLconstants (both available since Linux 2.2). Andsocket.IP_RECVORIGDSTADDRconstant (available since Linux 2.6.29).gh-120057: Added the
os.environ.refresh()method to updateos.environwith changes to the environment made byos.putenv(), byos.unsetenv(), or made outside Python in the same process. Patch by Victor Stinner.gh-120029: Expose
symtable.Symbol.is_type_parameter()in thesymtablemodule. Patch by Bénédikt Tran.gh-119819: Fix regression to allow logging configuration with multiprocessing queue types.
gh-65454:
unittest.mock.Mock.attach_mock()no longer triggers a call to aPropertyMockbeing attached.gh-117142: The
ctypesmodule may now be imported in all subinterpreters, including those that have their own GIL.gh-118835: Fix _pyrepl crash when using custom prompt with ANSI escape codes.
gh-81936:
help()andshowtopic()methods now respect a configured output argument topydoc.Helperand not use the pager in such cases. Patch by Enrico Tröger.gh-117398: The
_datetimemodule (C implementation fordatetime) now supports being imported in multiple interpreters.gh-119824: Print stack entry in
pdbwhen and only when user input is needed.gh-119838: In mixed arithmetic operations with
Fractionand complex, the fraction is now converted tofloatinstead ofcomplex.gh-119770: Make
termiosioctl()constants positive. Patch by Victor Stinner.gh-89727: Fix issue with
shutil.rmtree()where aRecursionErroris raised on deep directory trees.gh-119577: The
DeprecationWarningemitted when testing the truth value of anxml.etree.ElementTree.Elementnow describes unconditionally returningTruein a future version rather than raising an exception in Python 3.14.gh-89727: Partially fix issue with
shutil.rmtree()where aRecursionErroris raised on deep directory trees. A recursion error is no longer raised whenrmtree.avoids_symlink_attacksis false.gh-93963: Remove deprecated names from
importlib.abcas found inimportlib.resources.abc.gh-119118: Fix performance regression in the
tokenizemodule by caching thelinetoken attribute and calculating the column offset more efficiently.gh-89727: Fix issue with
os.fwalk()where aRecursionErrorwas raised on deep directory trees by adjusting the implementation to be iterative instead of recursive.gh-119594: If one calls pow(fractions.Fraction, x, module) with modulo not None, the error message now says that the types are incompatible rather than saying pow only takes 2 arguments. Patch by Wim Jeantine-Glenn and Mark Dickinson.
gh-119588:
zipfile.Path.is_symlinknow assesses if the given path is a symlink.gh-119562: Remove
ast.Num,ast.Str,ast.Bytes,ast.NameConstantandast.Ellipsis. They had all emitted deprecation warnings since Python 3.12. Patch by Alex Waygood.gh-119555: Catch
SyntaxErrorfromcompile()in the runsource() method of the InteractiveColoredConsole. Patch by Sergey B Kirpichev.gh-118908: Limit exposed globals from internal imports and definitions on new REPL startup. Patch by Eugene Triguba and Pablo Galindo.
gh-117865: Improve the import time of the
astmodule by deferring the import ofre. Patch by Jelle Zijlstra.gh-119127: Positional arguments of
functools.partial()objects now support placeholders viafunctools.Placeholder.gh-113892: Now, the method
sock_connectof