Update bundled Tcl/Tk in macOS installer to 8.6.15.
Check for runtime availability of ptsname_r
function on macos.
Updated macOS installer build to use OpenSSL 3.0.15.
Increases Windows required OS and API level to Windows 10.
Fix _Py_ThreadId
for Windows builds using MinGW. Patch by Tony Roberts.
Updated bundled Tcl/Tk to 8.6.15.
Ensures experimental free-threaded binaries remain installed when updating.
Ensure that Tools\msi\buildrelease.bat
uses different directories for
AMD64 and ARM64 builds.
Updated Windows build to use OpenSSL 3.0.15.
Add support for socket.TCP_QUICKACK
on Windows platforms.
The Windows build of CPython now requires 3.10 or newer.
:mod:`mimetypes` no longer fails when it encounters an inaccessible registry key.
Ensures correct import libraries are included in Windows installs.
Adds Unicode support and fixes audit events for _winapi.CreateNamedPipe
.
Add support for new pyrepl on Windows
Fixes py.exe
handling of shebangs like /usr/bin/env python3.12
,
which were previously interpreted as python3.exe
instead of
python3.12.exe
.
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.
Avoid crashing in :mod:`mmap` on Windows when the mapped memory is inaccessible due to file system errors or access violations.
Makes ssl.create_default_context()
ignore invalid certificates in
the Windows certificate store
Update GitHub CI workflows to use OpenSSL 3.0.15 and multissltests to use 3.0.15, 3.1.7, and 3.2.3.
Re-enable skipped tests for :mod:`zlib` on the s390x architecture: only skip checks of the compressed bytes, which can be different between zlib's software implementation and the hardware-accelerated implementation.
Updated test_ttk
to pass with Tcl/Tk 8.6.15.
Detect whether the test suite is running inside a systemd-nspawn container
with --suppress-sync=true
option, and skip the test_os
and
test_mmap
tests that are failing in this scenario.
Add capability to ignore entire files or directories in check warning CI tool
Update Lib/test/crashers/bogus_code_obj.py
so that it crashes properly
again.
Add tooling to check for changes in compiler warnings. Patch by Nate Ohlson.
Add tests for :func:`pkgutil.extend_path`. Patch by Andreas Stocker.
:func:`os.getloadavg` may throw :exc:`OSError` when running regression tests under certain conditions (e.g. chroot). This error is now caught and ignored, since reporting load average is optional.
Fix test_typing random leaks. Clear typing ABC caches when running tests for
refleaks (-R
option): call _abc_caches_clear()
on typing abstract
classes and their subclasses. Patch by Victor Stinner.
Add a test for :func:`readline.set_history_length`. Note that this test may fail on readline libraries.
Fix test_expanduser_pwd2()
of test_posixpath
. Call getpwnam()
to get pw_dir
, since it can be different than getpwall()
pw_dir
.
Patch by Victor Stinner.
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.
Cleaned up fixtures for importlib.metadata tests and consolidated behavior with 'test.support.os_helper'.
Add --single-process
command line option to Python test runner
(regrtest). Patch by Victor Stinner.
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.
regrtest test runner: Add XML support to the refleak checker (-R option). Patch by Victor Stinner.
Skip test_gdb
if the binary is relocated by BOLT. Patch by Donghee Na.
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.
Remove the current directory from sys.path
when using PyREPL.
Upgrade libexpat to 2.6.3
Enable compiler options that warn of potential security vulnerabilities.
Changed IPv4-mapped ipaddress.IPv6Address
to consistently use the mapped
IPv4 address value for deciding properties. Properties which have their
behavior fixed are is_multicast
, is_reserved
, is_link_local
,
is_global
, and is_unspecified
.
Add ability to ignore warnings per file with warning count in warning checking tooling. Patch by Nate Ohlson.
Add macOS warning tracking to warning check tooling. Patch by Nate Ohlson.
Authenticate the socket connection for the socket.socketpair()
fallback
on platforms where AF_UNIX
is not available like Windows.
Patch by Gregory P. Smith <greg@krypto.org> and Seth Larson <seth@python.org>. Reported by Ellie <el@horse64.org>
Fixed missing audit events around interactive use of Python, now also
properly firing for python -i
, as well as for python -m asyncio
. The
events in question are cpython.run_stdin
and cpython.run_startup
.
Enable runtime protections for glibc to abort execution when unsafe behavior is encountered, for all platforms except Windows.
Remove backtracking from tarfile header parsing for hdrcharset
, PAX, and
GNU sparse headers.
Add default compiler options to improve security. Enable -Wimplicit-fallthrough, -fstack-protector-strong, -Wtrampolines.
Fixes creation of ACLs in :func:`os.mkdir` on Windows to work correctly on non-English machines.
:func:`os.mkdir` on Windows now accepts mode of 0o700
to restrict the
new directory to the current user. This fixes :cve:`2024-4030` affecting
:func:`tempfile.mkdtemp` in scenarios where the base temporary directory is
more permissive than the default.
Fixed the bug where :mod:`pdb` and :mod:`bdb` can step into the bottom caller frame.
Fixed the bug where :mod:`pdb` will be stuck in an infinite loop when debugging an empty file.
Fix :func:`time.strptime` for %c
, %x
and %X
formats in many
locales that use non-ASCII digits, like Persian, Burmese, Odia and Shan.
Workaround for old libffi versions is added. Module ctypes supports :c:expr:`double complex` only with libffi >= 3.3.0. Patch by Mikhail Efimov.
Make :class:`~weakref.WeakKeyDictionary` and :class:`~weakref.WeakValueDictionary` safe against concurrent mutations from other threads. Patch by Kumar Aditya.
The :func:`gzip.compress` mtime parameter now defaults to 0 for reproducible output. Patch by Bernhard M. Wiedemann and Adam Turner.
Fix data race when creating :class:`zoneinfo.ZoneInfo` objects in the free threading build.
Fix a bug where ArgumentError includes the incorrect ambiguous option in :mod:`argparse`.
Keep :mod:`tkinter` TCL paths in venv pointing to base installation on Windows.
Fix inheritance of nested mutually exclusive groups from parent parser in :class:`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.
Don't copy arbitrary values to :c:expr:`_Bool` in the :mod:`struct` module.
Fix an issue where providing a :class:`pathlib.PurePath` object as an initializer argument to a second :class:`~pathlib.PurePath` object with a different :attr:`~pathlib.PurePath.parser` resulted in arguments to the former object's initializer being joined by the latter object's parser.
If the :envvar:`PYTHON_BASIC_REPL` environment variable is set, the :mod:`site` module no longer imports the :mod:`!_pyrepl` module. Moreover, the :mod:`site` module now respects :option:`-E` and :option:`-I` command line options: ignore :envvar:`PYTHON_BASIC_REPL` in this case. Patch by Victor Stinner.
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.
Fix support for the barry_as_FLUFL
future flag in the new REPL.
Fix :func:`locale.nl_langinfo` in case when different categories have
different locales. The function now sets temporarily the LC_CTYPE
locale
in some cases. This temporary change affects other threads.
Fix refcycles in exceptions raised from :class:`asyncio.TaskGroup` and the python implementation of :class:`asyncio.Future`
Fix :func:`time.strptime` for %c
and %x
formats 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.
Convert :mod:`curses` to multi-phase initialization (PEP 489), thereby fixing reference leaks at interpreter shutdown. Patch by Bénédikt Tran.
Add SO_ORIGINAL_DST
to the :mod:`socket` module.
The default buffer size used by :func:`shutil.copyfileobj` has been increased from 64k to 256k on non-Windows platforms. It was already larger on Windows.
Skip the isatty
system call during open() when the file is known to not
be a character device. This provides a slight performance improvement when
reading whole files.
Allow calling :func:`os.path.exists` and :func:`os.path.lexists` with keyword arguments on Windows. Fixes a regression in 3.13.0.
:mod:`argparse` now raises early error for invalid help
arguments to
:meth:`~argparse.ArgumentParser.add_argument`,
:meth:`~argparse.ArgumentParser.add_subparsers` and :meth:`!add_parser`.
Fix detection of the minimal Queue API needed by the :mod:`logging` module. Patch by Bénédikt Tran.
The CLI of many modules (:mod:`ast`, :mod:`ensurepip`, :mod:`json`, :mod:`pdb`, :mod:`sqlite3`, :mod:`tokenize`, :mod:`venv`) now uses the actual executable name instead of simply "python" to display in the usage message.
Fix reference cycles left in tracebacks in :func:`asyncio.open_connection`
when used with happy_eyeballs_delay
Fixed :exc:`AssertionError` when using :func:`!asyncio.staggered.staggered_race` with :data:`asyncio.eager_task_factory`.
:meth:`argparse.ArgumentParser.add_argument` now raises an exception if an
:ref:`action` that does not consume arguments (like 'store_const' or
'store_true') or explicit nargs=0
are specified for positional
arguments.
Make :func:`tomllib.loads` raise :exc:`TypeError` not :exc:`AttributeError`
on bad input types that do not have the replace
attribute. Improve error
message when :class:`bytes` is received.
Fix a bug where :mod:`argparse` doesn't recognize negative complex numbers or negative numbers using scientific notation.
Fix :class:`typing.TypeAliasType` with incorrect type_params
argument.
Now it raises a :exc:`TypeError` when a type parameter without a default
follows one with a default, and when an entry in the type_params
tuple
is not a type parameter object.
Improved :ref:`prog` default value for :class:`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.
Fix :mod:`argparse` for namespaces with not directly writable dict (e.g. classes).
Add an annoation_format parameter to :func:`inspect.signature`. Add an quote_annotation_strings parameter to :meth:`inspect.Signature.format`. Use the new functionality to improve the display of annotations in signatures in :mod:`pydoc`. Patch by Jelle Zijlstra.
Fix conflicts between abbreviated long options in the parent parser and subparsers in :mod:`argparse`.
All :mod:`asyncio` REPL prompts run in the same :class:`context <contextvars.Context>`. Contributed by Bartosz Sławecki.
Fix support of :ref:`choices` with string value in :mod:`argparse`. Substrings of the specified string no longer considered valid values.
Provide :func:`sys.monitoring.clear_tool_id` to unregister all events and callbacks set by the tool.
Improve the accuracy of :mod:`bdb`'s check for the possibility of breakpoint in a frame. This makes it possible to disable unnecessary events in functions.
Fixed crash when using :func:`gc.get_referents` on a capsule object.
Fix :mod:`argparse` support of positional arguments with nargs='?'
,
default=argparse.SUPPRESS
and specified type
.
Fix a crash related to an integer overflow in :func:`curses.resizeterm` and :func:`curses.resize_term`.
Fix :class:`typing.TypeAliasType` not to be generic, when type_params
is
an empty tuple.
Fix support of arguments with :ref:`choices` in :mod:`argparse`. Positional
arguments with :ref:`nargs` equal to '?'
or '*'
no longer check
:ref:`default` against choices
. Optional arguments with nargs
equal
to '?'
no longer check :ref:`const` against choices
.
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.
Due to unreliable results on some devices, :func:`time.strftime` no longer accepts negative years on Android.
:func:`os.pidfd_open` and :func:`signal.pidfd_send_signal` are now unavailable when building against Android API levels older than 31, since the underlying system calls may cause a crash.
Add support for :func:`dataclasses.dataclass` in
:func:`unittest.mock.create_autospec`. Now create_autospec
will check
for potential dataclasses and use :func:`dataclasses.fields` function to
retrieve the spec information.
:mod:`argparse` vim supports abbreviated single-dash long options separated
by =
from its value.
Fixed a :mod:`pdb` bug where until
has no effect when it appears in a
commands
sequence. Also avoid printing the frame information at a
breakpoint that has a command list containing a command that resumes
execution.
Modify dataclasses to support zero-argument super() when slots=True
is
specified. This works by modifying all references to __class__
to point
to the newly created class.
Fix disallowing abbreviation of single-dash long options in :mod:`argparse`
with allow_abbrev=False
.
Fix parsing mutually exclusive arguments in :mod:`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".
Positional arguments with :ref:`nargs` equal to '*'
or
:data:`!argparse.REMAINDER` are no longer required. This allows to use
positional argument with nargs='*'
and without default
in mutually
exclusive group and improves error message about required arguments.
Fix parsing positional argument with :ref:`nargs` equal to '?'
or
'*'
if it is preceded by an option and another positional argument.
The :attr:`~ctypes.Structure._fields_` attribute of :class:`ctypes.Structure` and :class:`~ctypes.Union` is no longer set if the setattr operation raises an error.
:mod:`argparse` now ignores the first "--"
(double dash) between an
option and command.
Add RFC 9637 reserved IPv6 block 3fff::/20
in :mod:`ipaddress` module.
Improve the error message that may be raised by :meth:`datetime.date.fromtimestamp`.
Fixed potential crash when using :mod:`struct` to process zero-width 'Pascal
string' fields (0p
).
Fix handling of multiple "--"
(double dashes) in :mod:`argparse`. Only
the first one has now been removed, all subsequent ones are now taken
literally.
Fix a bug in :mod:`argparse` where lengthy subparser argument help is incorrectly indented.
The default :mod:`multiprocessing` start 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"
.
Fix invalid variable in :mod:`venv` handling of failed symlink on Windows
Add workaround for broken :c:func:`!fmod()` implementations on Windows, that
loose zero sign (e.g. fmod(-10, 1)
returns 0.0
). Patch by Sergey B
Kirpichev.
Remove broken :func:`time.thread_time` and :func:`time.thread_time_ns` on NetBSD.
Fix :class:`unittest.mock.MagicMock` resetting magic methods return values
after .reset_mock(return_value=True)
was called.
Update :mod:`unicodedata` database to Unicode 16.0.0.
Fix the command-line interface for the :mod:`random` module to select floats between 0 and N, not 1 and N.
Fix a bug where :mod:`argparse` doesn't recognize negative numbers with underscores
Fix parent slots detection for dataclasses that inherit from classes with
__dictoffset__
.
Add "_wmi"
to :data:`sys.stdlib_module_names`. Patch by Victor Stinner.
Fix error handling in :py:class:`~socket.socket` method :py:func:`~socket.socket.connect_ex` on platforms where :c:data:`errno` can be negative.
Added a new argument mode
to :class:`pdb.Pdb`. Only allow :mod:`pdb`
from command line to use restart
command.
Fix unbalanced quote errors occurring when activate.csh in :mod:`venv` was sourced with a custom prompt containing unpaired quotes or newlines.
Fix crash and memory leak in :func:`decimal.getcontext`. It crashed when
using a thread-local context by --with-decimal-contextvar=no
.
Fix :func:`inspect.getsource` for classes in :mod:`collections.abc` and
:mod:`decimal` (for pure Python implementation) modules.
:func:`inspect.getcomments` now raises OSError instead of IndexError if the
__firstlineno__
value for a class is out of bound.
Remove check for redefined memo entry in :func:`pickletools.dis`.
Fixed reference leak in the finalization of :mod:`tkinter`.
Pages generated by the :mod:`http.server` module allow the browser to apply its default dark mode.
Fix empty function name in :exc:`TypeError` when :func:`csv.reader`, :func:`csv.writer`, or :func:`csv.register_dialect` are used without the required args.
Fixed memory leak of :class:`typing.NoDefault` by moving it to the static types array.
Fix :attr:`ipaddress.IPv6Address.reverse_pointer` output according to :rfc:`RFC 3596, §2.5 <3596#section-2.5>`. Patch by Bénédikt Tran.
Make :class:`weakref.WeakSet` safe against concurrent mutations while it is being iterated. Patch by Kumar Aditya.
Show string value of :opcode:`CONTAINS_OP` oparg in :mod:`dis` output. Patch by Alexandr153.
Add :meth:`~object.__class_getitem__` to :class:`!tkinter.Event` for type subscript support at runtime. Patch by Adonis Rakateli.
Show string value of :opcode:`IS_OP` oparg in :mod:`dis` output.
Speed up normalization of :class:`pathlib.PurePath` and :class:`~pathlib.Path` objects by not interning string parts.
Applied a more surgical fix for malformed payloads in :class:`zipfile.Path` causing infinite loops (gh-122905) without breaking contents using legitimate characters.
Add :meth:`pathlib.Path.copy_into` and :meth:`~pathlib.Path.move_into`, which copy and move files and directories into existing directories.
Fix return type for :func:`!_pyrepl.readline._ReadlineWrapper.get_line_buffer` to be :func:`str`. Patch by Sergey B Kirpichev.
Raise audit events for the :func:`input` in the new REPL.
Fix :func:`urllib.parse.urljoin` and :func:`urllib.parse.urldefrag` for URIs containing empty components. For example, :func:`!urljoin` with relative reference "?" now sets empty query and removes fragment. Preserve empty components (authority, params, query, fragment) in :func:`!urljoin`. Preserve empty components (authority, params, query) in :func:`!urldefrag`.
Resolve a memory leak introduced in CPython 3.10's :mod:`ssl` when the :attr:`ssl.SSLSocket.session` property was accessed. Speeds up read and write access to said property by no longer unnecessarily cloning session objects via serialization.
Fix memory leak in :mod:`!_decimal`.
Consistently use same file name for different exceptions in the new repl. Patch by Sergey B Kirpichev.
:meth:`xml.etree.ElementTree.Element.extend` and :class:`~xml.etree.ElementTree.Element` assignment no longer hide the internal exception if an erroneous generator is passed. Patch by Bar Harel.
Preserve relative path in URL without netloc in :func:`urllib.parse.urlunsplit` and :func:`urllib.parse.urlunparse`.
Add support for rendering :class:`~dis.Positions` in :mod:`dis`.
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.
Deprecate :class:`!shutil.ExecError`, which hasn't been raised by any :mod:`shutil` function since Python 3.4. It's now an alias for :exc:`RuntimeError`.
In a bare call to :func:`importlib.resources.files`, ensure the caller's
frame is properly detected when importlib.resources
is itself available
as a compiled module only (no source).
Fix quadratic complexity in parsing "
-quoted cookie values with
backslashes by :mod:`http.cookies`.
Add support for :const:`~configparser.UNNAMED_SECTION` in :meth:`configparser.ConfigParser.add_section`.
When working with zip archives, importlib.resources now properly honors
module-adjacent references (e.g. files(pkg.mod)
and not just
files(pkg)
).
Fix :func:`inspect.getsource` for generated classes with Python base classes (e.g. enums).
zipfile.Path.glob
now correctly matches directories instead of silently
omitting them.
:class:`zipfile.Path` objects now sanitize names from the zipfile.
Enable :mod:`json` module to work as a script using the :option:`-m` switch:
python -m json
. See the :ref:`JSON command-line interface
<json-commandline>` documentation. Patch by Trey Hunner.
Deprecate :func:`!asyncio.iscoroutinefunction` in favor of :func:`inspect.iscoroutinefunction`.
:class:`logging.handlers.RotatingFileHandler` no longer rolls over empty log files.
Restore the deprecated :mod:`logging` warn()
method. It was removed in
Python 3.13 alpha 1. Keep the deprecated warn()
method in Python 3.13.
Patch by Victor Stinner.
Improve errors in the :mod:`pickle` module. :exc:`~pickle.PicklingError` is now raised more often instead of :exc:`UnicodeEncodeError`, :exc:`ValueError` and :exc:`AttributeError`, and the original exception is chained to it. Improve and unify error messages in Python and C implementations.
Bump the version of pip bundled in ensurepip to version 24.2.
Improve import time of :mod:`pprint` by around seven times. Patch by Hugo van Kemenade.
Add decorator
parameter to :func:`dataclasses.make_dataclass` to
customize the functional creation of dataclasses.
Fix the :class:`typing.TypeVar` constructor when name is passed by keyword.
Adjust cmath.tanh(nanj)
and cmath.tanh(infj)
for recent C standards.
Remove internal frames from tracebacks shown in
:class:`code.InteractiveInterpreter` with non-default
:func:`sys.excepthook`. Save correct tracebacks in
:data:`sys.last_traceback` and update __traceback__
attribute of
:data:`sys.last_value` and :data:`sys.last_exc`.
On Android, the FICLONE
and FICLONERANGE
constants are no longer
exposed by :mod:`fcntl`, as these ioctls are blocked by SELinux.
Make sure that the new :term:`REPL` interprets :data:`sys.tracebacklimit` in the same way that the classic REPL did.
Fix crash when importing :mod:`ssl` after the main interpreter restarts.
Optimize :mod:`pickling <pickle>` by name objects without the __module__
attribute.
In :class:`code.InteractiveInterpreter`, handle exceptions caused by calling a non-default :func:`sys.excepthook`. Before, the exception bubbled up to the caller, ending the :term:`REPL`.
On some platforms such as Linux, year with century was not 0-padded when
formatted by :meth:`~.datetime.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 Hsing
Handle :exc:`ValueError`s raised by :func:`os.stat` in :class:`filecmp.dircmp` and :func:`filecmp.cmpfiles`. Patch by Bénédikt Tran.
Fix some error messages in :mod:`pickle`.
:mod:`email` headers with embedded newlines are now quoted on output. The :mod:`~email.generator` will now refuse to serialize (write) headers that are unsafely folded or delimited; see :attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas Bloemsaat and Petr Viktorin in :gh:`121650`.)
Fixed segfault with :meth:`asyncio.Task.get_coro` when using an eager task factory.
:func:`ctypes.ARRAY` is now :term:`soft deprecated`: it no longer emits deprecation warnings and is not scheduled for removal.
Add notes for pickle serialization errors that allow to identify the source of the error.
As part of PEP 749, add the following attributes for customizing evaluation of annotation scopes:
evaluate_value
on :class:`typing.TypeAliasType`evaluate_bound
,evaluate_constraints
, andevaluate_default
on :class:`typing.TypeVar`evaluate_default
on :class:`typing.ParamSpec`evaluate_default
on :class:`typing.TypeVarTuple`
Fix handling of classes with custom metaclasses in
annotationlib.get_annotations
.
Handle :exc:`ValueError`s raised by :func:`os.stat` in :mod:`linecache`. Patch by Bénédikt Tran.
Add notes for JSON serialization errors that allow to identify the source of the error.
Improve support of method descriptors and wrappers in the help title.
Fix an issue when reporting tracebacks corresponding to Python code emitting an empty AST body. Patch by Nikita Sobolev and Bénédikt Tran.
Make :func:`logging.config.dictConfig` accept any object implementing the Queue public API. See the :ref:`queue configuration <configure-queue>` section for details. Patch by Bénédikt Tran.
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.
Pathlib.read_bytes
no 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.
:mod:`csv` now correctly parses numeric fields (when used with :const:`csv.QUOTE_NONNUMERIC` or :const:`csv.QUOTE_STRINGS`) which start with an escape character.
:func:`@warnings.deprecated <warnings.deprecated>` now copies the coroutine status of functions and methods so that :func:`inspect.iscoroutinefunction` returns the correct result.
Fix a crash in the :func:`!decimal.IEEEContext` optional function available
via the EXTRA_FUNCTIONALITY
configuration flag.
Add :meth:`pathlib.Path.move`, which moves a file or directory tree.
Remove workarounds for non-IEEE 754 systems in :mod:`cmath`.
Due to the lack of interest for :meth:`symtable.Class.get_methods`, the method is marked as deprecated and will be removed in Python 3.16. Patch by Bénédikt Tran.
Adjusts cmath.acosh(complex('0+nanj'))
for recent C standards.
Correctly show error locations, when :exc:`SyntaxError` raised in new repl. Patch by Sergey B Kirpichev.
Add alternative :class:`~fractions.Fraction` constructor :meth:`Fraction.from_number() <fractions.Fraction.from_number>`.
Add alternative :class:`~decimal.Decimal` constructor :meth:`Decimal.from_number() <decimal.Decimal.from_number>`.
Fixed a bug introduced by gh-92081 that added an incorrect extra blank to encoded words occurring in wrapped headers.
The shallow argument to :class:`filecmp.dircmp` (new in Python 3.13) is now keyword-only.
Simplify handling of the history file in site.register_readline()
helper. The CAN_USE_PYREPL
variable now will be initialized, when
imported. Patch by Sergey B Kirpichev.
Support the :c:expr:`float complex` and :c:expr:`double complex` C types in the :mod:`struct` module if the compiler has C11 complex arithmetic. Patch by Sergey B Kirpichev.
:mod:`math` functions :func:`~math.isqrt`, :func:`~math.log`,
:func:`~math.log2` and :func:`~math.log10` now support integers larger than
2**2**32
on 32-bit platforms.
Fix missing sanity check for parties
arg in :class:`threading.Barrier`
constructor. Patch by Clinton Christian (pygeek).
Hard-coded breakpoints (:func:`breakpoint` and :func:`pdb.set_trace`) now
reuse the most recent Pdb
instance that calls Pdb.set_trace()
,
instead of creating a new one each time. As a result, all the instance
specific data like display
and commands
are preserved across
Hard-coded breakpoints.
Slightly speed up :func:`os.walk` by simplifying exception handling.
Improve import time of :mod:`socket` by lazy importing modules and writing :data:`!socket.errorTab` as a constant.
:mod:`zipimport` supports now namespace packages when no directory entry exists.
Fix a crash in :ref:`OrderedDict.__eq__ <collections_OrderedDict__eq__>` when operands are mutated during the check. Patch by Bénédikt Tran.
Limit the reading size in the :class:`multiprocessing.connection.Connection` class to 64 KiB to prevent memory overallocation and unnecessary memory management system calls.
Fix constructor of :mod:`ast` nodes with custom _attributes
. Previously,
passing custom attributes would raise a :py:exc:`DeprecationWarning`.
Passing arguments to the constructor that are not in _fields
or
_attributes
remains deprecated. Patch by Jelle Zijlstra.
Fix a bug in the handling of the command history of the new :term:`REPL` that caused the history file to be wiped at REPL exit.
Handle AST nodes with missing runtime fields or attributes in :func:`ast.compare`. Patch by Bénédikt Tran.
Add support for all
as an valid action
for
:func:`warnings.simplefilter` and :func:`warnings.filterwarnings`.
Fix wrapping of long usage text of arguments inside a mutually exclusive group in :mod:`argparse`.
Add support for :func:`copy.replace` to AST nodes. Patch by Bénédikt Tran.
Fix waitpid race while calling :meth:`~asyncio.subprocess.Process.send_signal` in asyncio. Patch by Kumar Aditya.
Add a future warning in :meth:`!functools.partial.__get__`. In future Python versions :class:`functools.partial` will be a method descriptor.
Make the :class:`functools.partial` object a method descriptor.
CPython now detects whether its linked TLS library supports TLSv1.3 post-handshake authentication and disables that feature if support is lacking.
Improve the :meth:`~object.__repr__` of :class:`functools.partialmethod`. Patch by Bénédikt Tran.
Fixed issues where :meth:`!argparse.ArgumentParser.parse_args` did not honor
exit_on_error=False
. Based on patch by Ben Hsing.
Fix truncation of strings with embedded null characters in some internal operations in :mod:`tkinter`.
When reading installed files from an egg, use relative_to(walk_up=True)
to honor files installed outside of the installation root.
Support :c:expr:`float complex`, :c:expr:`double complex` and :c:expr:`long double complex` C types in :mod:`ctypes` as :class:`~ctypes.c_float_complex`, :class:`~ctypes.c_double_complex` and :class:`~ctypes.c_longdouble_complex` if the compiler has C11 complex arithmetic. Patch by Sergey B Kirpichev.
Upgrade pip wheel bundled with ensurepip (pip 24.1.1)
Accessing the :mod:`tkinter` object's string representation no longer converts the underlying Tcl object to a string on Windows.
Fix regression in the new REPL that meant that globals from files passed
using the -i
argument would not be included in the REPL's global
namespace. Patch by Alex Waygood.
Fix possible memory leak in :meth:`contextvars.Context.run`.
Fix wrong references of the :mod:`datetime` types after reloading the module.
:meth:`datetime.datetime.strftime` now 0-pads years with less than four
digits for the format specifiers %Y
and %G
on Linux. Patch by Ben
Hsing
Make empty line in :mod:`pdb` repeats the last command even when the command
is from cmdqueue
.
Show string value of LOAD_SPECIAL oparg in :mod:`dis` output.
Add :meth:`datetime.time.strptime` and :meth:`datetime.date.strptime`. Contributed by Wannes Boeykens.
:term:`Soft deprecate <soft deprecated>` :func:`os.popen` and :func:`os.spawn* <os.spawnl>` functions. They should no longer be used to write new code. The :mod:`subprocess` module is recommended instead. Patch by Victor Stinner.
Fix name
passing to :class:`unittest.mock.Mock` object when using
:func:`unittest.mock.create_autospec`.
:mod:`re` now handles patterns like "[\s\S]"
or "\s|\S"
which match
any character as effectively as a dot with the DOTALL
modifier
("(?s:.)"
).
Fix an error in :class:`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).
:class:`ipaddress.IPv4Address` and :class:`ipaddress.IPv6Address` attributes
version
and max_prefixlen
are now available on the class.
Move scrollbar and remove tear-off menus in turtledemo.
Allow users to use EOF to exit commands
definition in :mod:`pdb`
Allow :meth:`asyncio.Runner.run` to accept :term:`awaitable` objects instead of simply :term:`coroutine`s.
Improve the prompt in the "less" pager when :func:`help` is called with non-string argument.
Fix incorrect exception handling in Tab Nanny. Patch by Wulian233.
Improve a warning message when a test method in :mod:`unittest` returns
something other than None
. Now we show the returned object type and
optional asyncio-related tip.
Correct :func:`inspect.ismethoddescriptor` to check also for the lack of :meth:`~object.__delete__`. Patch by Jan Kaliszewski.
The OS byte in gzip headers is now always set to 255 when using :func:`gzip.compress`.
Fix column offset reporting for tokens that come after multiline f-strings in the :mod:`tokenize` module.
As part of implementing PEP 649 and PEP 749, add a new module
annotationlib
. Add support for unresolved forward references in
annotations to :mod:`dataclasses`, :class:`typing.TypedDict`, and
:class:`typing.NamedTuple`.
Fix :func:`unittest.mock.patch` to not read attributes of the target when
new_callable
is set. Patch by Robert Collins.
Fixed the use-after-free issue in :mod:`cProfile` by disallowing
disable()
and clear()
in external timers.
Added support for converting any objects that have the :meth:`!as_integer_ratio` method to a :class:`~fractions.Fraction`.
Fix edge-case bug where :func:`typing.get_type_hints` would produce
incorrect results if type parameters in a class scope were overridden by
assignments in a class scope and from __future__ import annotations
semantics were enabled. Patch by Alex Waygood.
Fix erroneous :exc:`NameError` when calling :func:`inspect.get_annotations`
with eval_str=True`
on a class that made use of PEP 695 type
parameters in a module that had from __future__ import annotations
at
the top of the file. Patch by Alex Waygood.
Prohibit passing None
to pure-Python :meth:`datetime.date.fromtimestamp`
to achieve consistency with C-extension implementation.
Fix memory leak in :func:`re.sub` when the replacement string contains backreferences.
Added commands
argument to :func:`pdb.set_trace` which allows users to
send debugger commands from the source file.
Fix :mod:`tkinter.ttk` with Tcl/Tk 9.0.
Fix crash in C version of :meth:`datetime.datetime.strptime` when called again on the restarted interpreter.
Defer the threading
import in importlib.util
until lazy loading is
used.
Remove unused constant concurrent.futures._base._FUTURE_STATES
in
:mod:`concurrent.futures`. Patch by Clinton Christian (pygeek).
:mod:`datetime` no longer crashes in certain complex reference cycle situations.
Fix :meth:`symtable.Class.get_methods` and document its behaviour. Patch by Bénédikt Tran.
Add :exc:`concurrent.futures.InvalidStateError` to module's __all__
.
Add the :class:`symtable.SymbolTableType` enumeration to represent the possible outputs of the :class:`symtable.SymbolTable.get_type` method. Patch by Bénédikt Tran.
Expose :class:`symtable.Symbol` methods :meth:`~symtable.Symbol.is_free_class`, :meth:`~symtable.Symbol.is_comp_iter` and :meth:`~symtable.Symbol.is_comp_cell`. Patch by Bénédikt Tran.
Fix calling :func:`copy.deepcopy` on :mod:`ast` trees that have been modified to have references to parent nodes. Patch by Jelle Zijlstra.
Add :data:`!socket.IP_RECVERR` and :data:`!socket.IP_RECVTTL` constants (both available since Linux 2.2). And :data:`!socket.IP_RECVORIGDSTADDR` constant (available since Linux 2.6.29).
Support building :mod:`tkinter` with Tcl 9.0.
Added the :data:`os.environ.refresh() <os.environ>` method to update :data:`os.environ` with changes to the environment made by :func:`os.putenv`, by :func:`os.unsetenv`, or made outside Python in the same process. Patch by Victor Stinner.
Expose :meth:`symtable.Symbol.is_type_parameter` in the :mod:`symtable` module. Patch by Bénédikt Tran.
Fix regression to allow logging configuration with multiprocessing queue types.
:func:`unittest.mock.Mock.attach_mock` no longer triggers a call to a
PropertyMock
being attached.
The :mod:`ctypes` module may now be imported in all subinterpreters, including those that have their own GIL.
Fix _pyrepl crash when using custom prompt with ANSI escape codes.
:meth:`!help` and :meth:`!showtopic` methods now respect a configured output argument to :class:`!pydoc.Helper` and not use the pager in such cases. Patch by Enrico Tröger.
The _datetime
module (C implementation for :mod:`datetime`) now supports
being imported in multiple interpreters.
Print stack entry in :mod:`pdb` when and only when user input is needed.
In mixed arithmetic operations with :class:`~fractions.Fraction` and complex, the fraction is now converted to :class:`float` instead of :class:`complex`.
Make :mod:`termios` ioctl()
constants positive. Patch by Victor Stinner.
Fix issue with :func:`shutil.rmtree` where a :exc:`RecursionError` is raised on deep directory trees.
The :exc:`DeprecationWarning` emitted when testing the truth value of an
:class:`xml.etree.ElementTree.Element` now describes unconditionally
returning True
in a future version rather than raising an exception in
Python 3.14.
Partially fix issue with :func:`shutil.rmtree` where a :exc:`RecursionError` is raised on deep directory trees. A recursion error is no longer raised when :data:`!rmtree.avoids_symlink_attacks` is false.
Remove deprecated names from importlib.abc
as found in
importlib.resources.abc
.
Fix performance regression in the :mod:`tokenize` module by caching the
line
token attribute and calculating the column offset more efficiently.
Fix issue with :func:`os.fwalk` where a :exc:`RecursionError` was raised on deep directory trees by adjusting the implementation to be iterative instead of recursive.
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.
zipfile.Path.is_symlink
now assesses if the given path is a symlink.
Remove :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis`. They had all emitted deprecation warnings since Python 3.12. Patch by Alex Waygood.
Catch :exc:`SyntaxError` from :func:`compile` in the runsource() method of the InteractiveColoredConsole. Patch by Sergey B Kirpichev.
Limit exposed globals from internal imports and definitions on new REPL startup. Patch by Eugene Triguba and Pablo Galindo.
Improve the import time of the :mod:`ast` module by deferring the import of :mod:`re`. Patch by Jelle Zijlstra.
Positional arguments of :func:`functools.partial` objects now support placeholders via :data:`functools.Placeholder`.
Now, the method sock_connect
of :class:`asyncio.ProactorEventLoop`
raises a :exc:`ValueError` if given socket is not in non-blocking mode, as
well as in other loop implementations.
Fix :meth:`!io.TextIOWrapper.write` method breaks internal buffer when the method is called again during flushing internal buffer.
Fix fcntl.ioctl()
request parameter: use an unsigned long
instead
of an unsigned int
for the request parameter of :func:`fcntl.ioctl` to
support requests larger than UINT_MAX
. Patch by Victor Stinner.
difflib
's DIffer.compare()
(and so also ndiff
) can no longer be
provoked into cubic-time behavior, or into unbounded recursion, and should
generally be faster in ordinary cases too. Results may change in some cases,
although that should be rare. Correctness of diffs is not affected. Some
similar lines far apart may be reported as deleting one and adding the
other, where before they were displayed on adjacent output lines with markup
showing the intraline differences.
The interactive REPL no longer runs with from __future__ import
annotations
enabled. Patch by Jelle Zijlstra.
Add socket.VMADDR_CID_LOCAL
constant. Patch by Victor Stinner.
Objects in the datetime C-API are now all statically allocated, which means better memory safety, especially when the module is reloaded. This should be transparent to users.
:mod:`asyncio` REPL now has the same capabilities as PyREPL.
Bump :mod:`pickle` default protocol to 5
.
In PyREPL, updated maybe-accept
's logic so that if the user hits
Enter twice, they are able to terminate the block even if there's
trailing whitespace. Also, now when the user hits arrow up, the cursor is on
the last functional line. This matches IPython's behavior. Patch by Aya
Elsayed.
Raise error on certain technically valid but pathological ISO 8601 strings passed to :meth:`datetime.time.fromisoformat` that were previously parsed incorrectly.
Remove dependency to :mod:`readline` from the new Python REPL.
When using the **
operator or :func:`pow` with
:class:`~fractions.Fraction` as the base and an exponent that is not
rational, a float, or a complex, the fraction is no longer converted to a
float.
Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry Patch by Wulian233 and Terry Jan Reedy
Fix a NameError happening in asyncio.staggered.staggered_race
. This
function is now tested.
difflib.Differ
is much faster for some cases of diffs where many pairs
of lines are equally similar.
Fix issue where :meth:`pathlib.PurePath.with_suffix` didn't raise
:exc:`TypeError` when given None
as a suffix.
Fix an AttributeError in the :mod:`email` module when re-fold a long address list. Also fix more cases of incorrect encoding of the address separator in the address list.
Add :meth:`pathlib.Path.copy`, which copies a file or directory to another.
Make :mod:`pdb` return to caller frame correctly when f_trace
of the
caller frame is not set
Support single-dot file extensions in :attr:`pathlib.PurePath.suffix` and
related attributes and methods. For example, the
:attr:`~pathlib.PurePath.suffixes` of PurePath('foo.bar.')
are now
['.bar', '.']
rather than []
. This brings file extension splitting
in line with :func:`os.path.splitext`.
Remove :data:`!version` and :data:`!version_info` from :mod:`sqlite3`. Patch by Hugo van Kemenade.
Disallow using a sequence of parameters with named placeholders in :mod:`sqlite3` queries. Patch by Erlend E. Aasland.
Setting attributes on :data:`typing.NoDefault` now raises :exc:`AttributeError` instead of :exc:`TypeError`.
Fixed issue where kwargs were no longer passed to the logging handler QueueHandler
Remove deprecated :class:`!Quoter` class from :mod:`urllib.parse`. It had previously raised a :exc:`DeprecationWarning` since Python 3.11. Patch by Nikita Sobolev.
Remove deprecated :func:`!pty.master_open` and :func:`!pty.slave_open`. Use :func:`pty.openpty` instead. Patch by Nikita Sobolev.
ctx
arguments to the constructors of :mod:`ast` node classes now default
to :class:`ast.Load() <ast.Load>`. Patch by Jelle Zijlstra.
Remove copy, deepcopy, and pickle from itertools. These had previously raised a DeprecationWarning since Python 3.12.
Remove type, choices, and metavar parameters of :class:`!argparse.BooleanOptionalAction`. They were deprecated since Python 3.12.
:class:`!typing.ByteString` and :class:`!collections.abc.ByteString` are removed. They had previously raised a :exc:`DeprecationWarning` since Python 3.12.
The isdst parameter has been removed from :func:`email.utils.localtime`. Patch by Hugo van Kemenade.
Restore the default value of tkiter.wantobjects
to 1
.
Fix errors in calling Tkinter bindings on Windows.
Drop support for passing keyword arguments to :class:`pathlib.Path`.
Suppress all :exc:`OSError` exceptions from :meth:`pathlib.Path.exists` and
is_*()
methods, rather than a selection of more common errors. The new
behaviour is consistent with :func:`os.path.exists`, :func:`os.path.isdir`,
etc. Use :meth:`pathlib.Path.stat` to retrieve the file status without
suppressing exceptions.
Drop support for passing additional positional arguments to :meth:`pathlib.PurePath.relative_to` and :meth:`~pathlib.PurePath.is_relative_to`.
Fix :func:`os.path.isfile` on Windows for pipes. Speedup :func:`os.path.isjunction` and :func:`os.path.lexists` on Windows with a native implementation.
Allow :class:`typing.TypeVar` instances without a default to follow instances without a default in some cases. Patch by Jelle Zijlstra.
Allow restart
in post-mortem debugging of :mod:`pdb`. Removed restart
message when the user quits pdb from post-mortem mode.
Removed executable bits and shebang from stdlib modules.
:func:`os.path.realpath` now suppresses any :exc:`OSError` from :func:`os.readlink` when strict mode is disabled (the default).
Speed up :func:`os.path.splitroot` & :func:`os.path.normpath` with a direct C call.
Fix ctypes structs with array on SPARC by setting MAX_STRUCT_SIZE
to 32
in stgdict. Patch by Jakub Kulik
Fix :func:`dataclasses.dataclass` not creating a __weakref__
slot when
subclassing :class:`typing.Generic`.
Always use :func:`str` to print choices
in :mod:`argparse`.
In :mod:`importlib.resources`, sync with importlib_resources 6.3.2,
including: MultiplexedPath
now expects Traversable
paths,
deprecating string arguments to MultiplexedPath
; Enabled support for
resources in namespace packages in zip files; Fixed NotADirectoryError
when calling files on a subdirectory of a namespace package.
Removed extra preprocessing for the __signature__
attribute: the code
just check if it's a :class:`inspect.Signature` instance. Patch by Sergey B
Kirpichev.
Add :func:`operator.is_none` and :func:`operator.is_not_none` functions.
Improve performance of :func:`copy.deepcopy` by adding a fast path for atomic types.
Add doc parameter to :func:`dataclasses.field`, so it can be stored and
shown as a documentation / metadata. If @dataclass(slots=True)
is used,
then the supplied string is available in the :attr:`~object.__slots__` dict.
Otherwise, the supplied string is only available in the corresponding
:class:`dataclasses.Field` object.
In order to support this feature we are changing the __slots__
format in
dataclasses from :class:`tuple` to :class:`dict` when documentation /
metadata is present.
Ignore warnings on text completion inside REPL.
Correct argparse usage output for required, mutually exclusive groups containing a positional argument
webbrowser
honors OS preferred browser on Linux when its desktop entry
name contains the text of a known browser name.
You can now get the raw TLS certificate chains from TLS connections via :meth:`ssl.SSLSocket.get_verified_chain` and :meth:`ssl.SSLSocket.get_unverified_chain` methods.
Contributed by Mateusz Nowak.
Fix performance degradation in :class:`logging.handlers.RotatingFileHandler`. Patch by Craig Robson.
Add missing ISO-8601 24:00 alternative to midnight of next day to :meth:`datetime.datetime.fromisoformat` and :meth:`datetime.time.fromisoformat`. Patch by Izan "TizzySaurus" Robinson (tizzysaurus@gmail.com)
Fix lack of newline characters in :mod:`trace` module output when line tracing is enabled but source code line for current frame is not available.
Fix missing spaces in email headers when the spaces are mixed with encoded 8-bit characters.
Prepare Tkinter for C API changes in Tcl 8.7/9.0 to avoid :class:`!_tkinter.Tcl_Obj` being unexpectedly returned instead of :class:`bool`, :class:`str`, :class:`bytearray`, or :class:`int`.
Fixed handling in :meth:`inspect.Signature.bind` of keyword arguments having
the same name as positional-only arguments when a variadic keyword argument
(e.g. **kwargs
) is present.
Add additional methods to :ref:`proxy objects <multiprocessing-proxy_objects>` in the :mod:`!multiprocessing` module:
- :meth:`!clear` and :meth:`!copy` for proxies of :class:`list`
- :meth:`~dict.fromkeys`,
reversed(d)
,d | {}
,{} | d
,d |= {'b': 2}
for proxies of :class:`dict`
Fix integer conversion in :func:`os.major`, :func:`os.minor`, and
:func:`os.makedev`. Support device numbers larger than 2**63-1
. Support
non-existent device number (NODEV
).
Do not translate user-provided strings in :class:`argparse.ArgumentParser`.
Solaris now uses :func:`os.sendfile` fast-copy syscall for more efficient :mod:`shutil` file copy related functions.
Implemented :func:`ast.compare` for comparing two ASTs. Patch by Batuhan Taskaya with some help from Jeremy Hylton.
Fix :func:`urllib.parse.urlunparse` and :func:`urllib.parse.urlunsplit` for URIs with path starting with multiple slashes and no authority. Based on patch by Ashwin Ramaswami.
Fix :mod:`argparse` metavar processing to allow positional arguments to have a tuple metavar.
Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors.
Fix uninteruptable hang when Shell gets rapid continuous output.
Change About IDLE to direct users to discuss.python.org instead of the now unused idle-dev email and mailing list.
Stop Shell freezes by blocking user access to non-method sys.stdout.shell attributes, which are all private.
Add explicit black IDLE Hovertip foreground color needed for recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles.
Fix padding in config and search dialog windows in IDLE.
Added definitions for :term:`context`, :term:`current context`, and :term:`context management protocol`, updated related definitions to be consistent, and expanded the documentation for :class:`contextvars.Context`.
The :mod:`importlib.metadata` documentation now includes semantic cross-reference targets for the significant documented APIs. This means intersphinx references like :func:`importlib.metadata.version` will now work as expected.
Update "Using Python on a Mac" section of the "Python Setup and Usage" document and include information on installing free-threading support.
Remove coverity scan from the CPython repo. It has not been used since 2020 and is currently unmaintained.
Add an Android platform guide, and flag modules not available on Android.
Refresh docs around custom providers.
Clarified the dual usage of the term "free variable" (both the formal
meaning of any reference to names defined outside the local scope, and the
narrower pragmatic meaning of nonlocal variables named in co_freevars
).
Writers of CPython's documentation can now use next
as the version for
the versionchanged
, versionadded
, deprecated
directives.
Improved documentation for :func:`unittest.mock.patch.dict`
Fix documentation for :c:func:`PyModule_AddObjectRef`.
Clarify the behaviours of :meth:`multiprocessing.Queue.empty` and :meth:`multiprocessing.SimpleQueue.empty` on closed queues. Patch by Bénédikt Tran.
Added some missing environment variables to the output of :option:`--help-env`.
The :c:func:`Py_Main` documentation moved from the "Very High Level API" section to the "Initialization and Finalization" section.
Also make it explicit that we expect Py_Main
to typically be called
instead of Py_Initialize
rather than after it (since Py_Main
makes
its own call to Py_Initialize
). Document that calling both is supported
but is version dependent on which settings will be applied correctly.
Fix a crash in the free threading build when the GC runs concurrently with a new thread starting.
Fix possible race condition when calling :meth:`~object.__reduce_ex__` for the first time in the free threading build.
Make the handling of reference counts of immortal objects more robust. Immortal objects with reference counts that deviate from their original reference count by up to a billion (half a billion on 32 bit builds) are still counted as immortal.
Make this_instr
and prev_instr
const in cases generator.
Fix :func:`tokenize.untokenize` producing invalid syntax for double braces preceded by certain escape characters.
Fix compiler bug (in some versions of 3.13) where an assertion fails during reachability analysis.
Fix a crash in the :meth:`~object.__str__` method of :exc:`UnicodeError` objects when the :attr:`UnicodeError.start` and :attr:`UnicodeError.end` values are invalid or out-of-range. Patch by Bénédikt Tran.
Improve the experimental JIT compiler's ability to stay "on trace" when encountering highly-biased branches.
Fixed scalability issue in free-threaded builds for lock-free reads from dictionaries in multi-threaded scenarios
Fix a crash caused by immortal interned strings being shared between sub-interpreters that use basic single-phase init. In that case, the string can be used by an interpreter that outlives the interpreter that created and interned it. For interpreters that share obmalloc state, also share the interned dict with the main interpreter.
Fix a bug that can cause a crash when sub-interpreters use "basic" single-phase extension modules. Shared objects could refer to PyGC_Head nodes that had been freed as part of interpreter cleanup.
The __main__
module no longer always contains an __annotations__
dictionary in its global namespace.
When deallocating an object with inline values whose __dict__
is still
live: if memory allocation for the inline values fails, clear the
dictionary. Prevents an interpreter crash.
Fix a crash in FrameLocalsProxy constructor: check the number of arguments. Patch by Victor Stinner.
Fix nondeterminism in compilation by sorting the value of :attr:`~type.__static_attributes__`. Patch by kp2pml30.
Fix bug where bool(a)
can be invoked more than once during the
evaluation of a compound boolean expression.
Fix PyREPL failure when a keyboard interrupt is triggered after using a history search
Deprecate the setting and using __package__
and __cached__
.
The JIT now generates more efficient code for calls to C functions resulting in up to 0.8% memory savings and 1.5% speed improvement on AArch64. Patch by Diego Russo.
Use the pager
binary, if available (e.g. on Debian and derivatives), to
display REPL help()
.
Fix reading and decoding a line from the source file with non-UTF-8 encoding for syntax errors raised in the compiler.
Support <page up>
, <page down>
, and <delete>
keys in the Python
REPL when $TERM
is set to vt100
.
Fix bug where docstring is removed from classes in interactive mode.
docstrings are now removed from the optimized AST in optimization level 2.
The f_executable
field in the internal :c:struct:`_PyInterpreterFrame`
struct now uses a tagged pointer. Profilers and debuggers that uses this
field should clear the least significant bit to recover the
:c:expr:`PyObject*` pointer.
Fix possible crash in the garbage collector when it tries to break a reference loop containing a :class:`memoryview` object. Now a :class:`!memoryview` object can only be cleared if there are no buffers that refer it.
asyncio REPL is now again properly recognizing KeyboardInterrupts. Display of exceptions raised in secondary threads is fixed.
Allow the new interactive shell to read history files written with the editline library that use unicode-escaped entries. Patch by aorcajo and Łukasz Langa.
Fix key mappings for various F-keys in Windows for the new REPL. Patch by devdanzin
Add :func:`turtle.save` to easily save Turtle drawings as PostScript files. Patch by Marie Roald and Yngve Mardal Moe.
Setting the :attr:`!__module__` attribute for a class now removes the
__firstlineno__
item from the type's dict, so they will no longer be
inconsistent.
Change <page up>
and <page down>
keys of the Python REPL to history
search forward/backward. Patch by Victor Stinner.
Improve :exc:`SyntaxError` message for using case ... as ...
with not a
name.
Fix a double decref in rare cases on experimental JIT builds.
Fix _Py_DebugOffsets
for long objects to be relative to the start of the
object rather than the start of a subobject.
Fix empty function name in :exc:`TypeError` when builtin magic methods are used without the required args.
Improve :exc:`SyntaxError` message for using except as
with not a name.
Improved JIT memory consumption by periodically freeing memory used by infrequently-executed code. This change is especially likely to improve the memory footprint of long-running programs.
Add AST optimizations for type parameter defaults.
Prevent Parser/myreadline race condition from segfaulting on multi-threaded use. Patch by Bar Harel and Amit Wienner.
Fix a bug causing stray prompts to appear in the middle of wrapped lines in the new REPL.
Extend the deprecation period for bool inversion (~
) by two years.
Make concurrent iterations over the same :func:`zip` iterator safe under free-threading.
Support :option:`-X gil=1 <-X>` and :envvar:`PYTHON_GIL=1 <PYTHON_GIL>` on non-free-threaded builds.
Deactivate line wrap in the Apple Terminal via a ANSI escape code. Patch by Pablo Galindo
Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer. Patch by Pablo Galindo
Restore printout of GC stats when gc.set_debug(gc.DEBUG_STATS)
is
called. This feature was accidentally removed when implementing incremental
GC.
Correctly show error locations when a :exc:`SyntaxError` is raised in the basic REPL. Patch by Sergey B Kirpichev.
Enables inline values (Python's equivalent of hidden classes) on any class who's instances are of a fixed size.
Fix too-wide source location in exception tracebacks coming from broken iterables in comprehensions.
Fix a bug where pattern matching code could emit a :opcode:`JUMP_FORWARD` with no source location.
Break up CALL_ALLOC_AND_ENTER_INIT
into micro-ops and relax requirement
for exact args, in order to increase the amount of code supported by tier 2.
Fix displaying :exc:`SyntaxError` exceptions covering multiple lines. Patch by Pablo Galindo
Fix a potential use-after-free in STORE_ATTR_WITH_HINT
.
Fix crash in free-threaded build when calling :c:func:`Py_Initialize` from a non-main thread.
Add three specializations for :opcode:`CALL_KW`:
- :opcode:`!CALL_KW_PY` for calls to Python functions
- :opcode:`!CALL_KW_BOUND_METHOD` for calls to bound methods
- :opcode:`!CALL_KW_NON_PY` for all other calls
Make sure that branches in :keyword:`while` statements have consistent offsets for :mod:`sys.monitoring`. :keyword:`!while` statements are now compiled with a simple jump at the end of the body, instead of duplicating the test.
Building with HAVE_DYNAMIC_LOADING
now works as well as it did in 3.12.
Existing deficiences will be addressed separately. (See
#122950.)
Fix crash on certain calls to str()
with positional arguments of the
wrong type. Patch by Jelle Zijlstra.
Improve the experimental JIT's handling of polymorphic code.
Fixed memory leaks at interpreter shutdown in the free-threaded build, and also reporting of leaked memory blocks via :option:`-X showrefcount <-X>`.
Fix Android stdout and stderr messages being truncated or lost.
Fix a crash that occurred when a PyStructSequence
was deallocated after
its type's dictionary was cleared by the GC. The type's
:c:member:`~PyTypeObject.tp_basicsize` now accounts for non-sequence fields
that aren't included in the :c:macro:`Py_SIZE` of the sequence.
Add only fields which are modified via self.* to :attr:`~type.__static_attributes__`.
In the free-threaded build, the reference counts for heap type objects are now partially stored in a distributed manner in per-thread arrays. This reduces contention on the heap type's reference count fields when creating or destroying instances of the same type from multiple threads concurrently.
Fix an issue in JIT builds that prevented some :keyword:`for` loops from correctly firing :monitoring-event:`RAISE` monitoring events.
Preserve AST nodes for f-string with single-element format specifiers. Patch by Pablo Galindo
:attr:`frame.f_locals` now supports arbitrary hashable objects as keys.
When a :class:`list`, :class:`tuple` or :class:`dict` with too many elements is unpacked, show the actual length in the error message.
Detection of writes to __debug__
is moved from the compiler's codegen
stage to the symtable. This means that these errors are now detected even in
code that is optimized away before codegen (such as assertions with the
:option:`-O` command line option).
Specializations for sums with float and complex inputs in :func:`sum` now always use compensated summation. Also, for integer items in above specializations: :c:func:`PyLong_AsDouble` is used, instead of :c:func:`PyLong_AsLongAndOverflow`. Patch by Sergey B Kirpichev.
Dictionary watchers now only deliver the PyDict_EVENT_ADDED event when the insertion is in a known good state to succeed.
Remove the BUILD_CONST_KEY_MAP
opcode. Use :opcode:`BUILD_MAP` instead.
Emit c_call
events in :func:`sys.setprofile` when a PyMethodObject
pointing to a PyCFunction
is called.
Fix a bug that caused the tokenizer to not correctly identify mismatched parentheses inside f-strings in some situations. Patch by Pablo Galindo
Python's hashlib now unconditionally uses the vendored HACL* library for Blake2. Python no longer accepts libb2 as an optional dependency for Blake2.
We refreshed HACL* to the latest version, and now vendor HACL*'s 128-bit and 256-bit wide vector implementations for Blake2, which are used on x86/x64 toolchains when the required CPU features are available at runtime.
HACL*'s 128-bit wide vector implementation of Blake2 can also run on ARM NEON and Power8, but lacking evidence of a performance gain, these are not enabled (yet).
The default extraction filter for the :mod:`tarfile` module is now set to :func:`'data' <tarfile.data_filter>`.
Fix crash when rematerializing a managed dictionary after it was deleted.
Improve performance of set membership testing, set.remove()
and
set.discard()
when the argument is a set.
Fixed the SegFault when :c:func:`PyEval_SetTrace` is used with no Python frame on stack.
Fix PyREPL console getting into a blocked state after interrupting a long paste
Fix bug in free-threaded Python where a resurrected object could lead to a negative ref count assertion failure.
Improve the :exc:`SyntaxError` message if the user tries to use :keyword:`yield from <yield>` outside a function.
Fix pasting of characters containing unicode character joiners in the new REPL. Patch by Marta Gomez Macias
Previously, incorrect usage of :keyword:`await` or asynchronous comprehensions in code removed by the :option:`-O` option was not flagged by the Python compiler. Now, such code raises :exc:`SyntaxError`. Patch by Jelle Zijlstra.
Unexpected slot wrappers are no longer created for builtin static types in subinterpreters.
Optimized performance of hex_from_char by replacing switch-case with a lookup table
Fix a bug affecting how multi-line history was being rendered in the new REPL after interacting with the new screen cache. Patch by Pablo Galindo
Fix a bug that was preventing the REPL to correctly respect the history when an input hook was set. Patch by Pablo Galindo
Tier 2 execution now ensures that list iterators remain exhausted, once they become exhausted.
Allow tuples of length 20 in the freelist to be reused.
:exc:`ValueError` messages for :meth:`!list.index`, :meth:`!range.index`, :meth:`!deque.index`, :meth:`!deque.remove` and :meth:`!ShareableList.index` no longer contain the repr of the searched value (which can be arbitrary large) and are consistent with error messages for other :meth:`!index` and :meth:`!remove` methods.
Fix race condition in _PyType_Lookup
in the free-threaded build due to a
missing memory fence. This could lead to _PyType_Lookup
returning
incorrect results on arm64.
Added specialization for summation of complexes, this also improves accuracy of builtin :func:`sum` for such inputs. Patch by Sergey B Kirpichev.
Fix f-strings with debug expressions in format specifiers. Patch by Pablo Galindo
Remove subprocess._USE_VFORK
escape hatch code and documentation. It was
added just in case, and doesn't have any known cases that require it.
Optimize code layout for calls to C functions from the JIT on AArch64. Patch by Diego Russo.
:c:func:`PyLong_AsNativeBytes` no longer uses :meth:`~object.__index__`
methods by default. The Py_ASNATIVEBYTES_ALLOW_INDEX
flag has been added
to allow it.
:c:func:`Py_Finalize()` and :c:func:`Py_FinalizeEx()` now always run with the main interpreter active.
Subinterpreters now get cleaned up automatically during runtime finalization.
Improve the speed and memory use of C function calls from JIT code on AArch64. Patch by Diego Russo
Simplify the warmup mechanism used for "side exits" in JIT code, resulting in slightly better performance and slightly lower memory usage for most platforms.
Fix too wide source locations of the cleanup instructions of a with statement.
Reduce the number of system calls invoked when reading a whole file (ex.
open('a.txt').read()
). For a sample program that reads the contents of
the 400+ .rst
files in the cpython repository Doc
folder, there is
an over 10% reduction in system call count.
Make sure that invariants of type versioning are maintained: * Superclasses always have their version number assigned before subclasses * The version tag is always zero if the tag is not valid. * The version tag is always non-if the tag is valid.
Fix _CHECK_STACK_SPACE
optimization problems introduced in :gh:`118322`.
Correctly set the bytecode position on return instructions within lambdas. Patch by Jelle Zijlstra.
Fix bug where compiler creates a redundant jump during pseudo-op replacement. Can only happen with a synthetic AST that has a try on the same line as the instruction following the exception handler.
Remove the BEFORE_WITH
and BEFORE_ASYNC_WITH
instructions. Add the
new :opcode:`LOAD_SPECIAL` instruction. Generate code for with
and
async with
statements using the new instruction.
Strings interned with :func:`sys.intern` are again garbage-collected when no longer used, as per the documentation. Strings interned with the C function :c:func:`PyUnicode_InternInPlace` are still immortal. Internals of the string interning mechanism have been changed. This may affect performance and identities of :class:`str` objects.
Add an override of allow_reuse_port
on classes subclassing
socketserver.TCPServer
where allow_reuse_address
is also overridden.
Fix an array out of bounds crash in list_ass_subscript
, which could be
invoked via some specifically tailored input: including concurrent
modification of a list object, where one thread assigns a slice and another
clears it.
Fix crash in compiler on code with redundant NOPs and JUMPs which show up after exception handlers are moved to the end of the code.
Fix Python implementation of :class:`pickle.Pickler` for :class:`bytes` and :class:`bytearray` objects when using protocol version 5. Patch by Bénédikt Tran.
Improve the throughput by up to two times for the :meth:`str.count`, :meth:`bytes.count` and :meth:`bytearray.count` methods for counting single characters.
Deliver real signals on Ctrl-C and Ctrl-Z in the new REPL. Patch by Pablo Galindo
Respect :envvar:`PYTHON_BASIC_REPL` when running in interactive inspect mode
(python -i
). Patch by Pablo Galindo
Fix source locations of instructions generated for the iterator of a for statement.
Fix a crash when multiple threads read and write to the same __class__
of an object concurrently.
Fix use-after free in list_richcompare_impl
which can be invoked via
some specifically tailored evil input.
Fix a compiler crash in the case where two comprehensions in class scope
both reference __class__
.
JIT: Re-use trampolines on AArch64 when creating stencils. Patch by Diego Russo
Fix crash in compiler on empty block at end of exception handler.
Fix source locations of instructions generated for with statements.
FrameLocalsProxy
now subclasses collections.abc.Mapping
and can be
matched as a mapping in match
statements
Direct call to the :meth:`!int.__round__` now accepts None
as a valid
argument.
Improve :exc:`SyntaxError` messages for invalid expressions in a type parameters bound, a type parameter constraint tuple or a default type parameter. Patch by Bénédikt Tran.
Reverted improvements to error messages for elif
/else
statements not
matching any valid statements, which made in hard to locate the syntax
errors inside those elif
/else
blocks.
String search is now slightly faster for certain cases. It now utilizes last character gap (good suffix rule) for two-way periodic needles.
Honor :c:func:`PyOS_InputHook` in the new REPL. Patch by Pablo Galindo
:func:`classmethod` and :func:`staticmethod` now wrap the :attr:`~object.__annotations__` and :attr:`~object.__annotate__` attributes of their underlying callable lazily. See PEP 649. Patch by Jelle Zijlstra.
Fix execution of :ref:`annotation scopes <annotation-scopes>` within classes
when globals
is set to a non-dict. Patch by Jelle Zijlstra.
Make PyEval_GetLocals
return borrowed reference
Remove the previously-deprecated delegation of :func:`int` to :meth:`~object.__trunc__`.
Generate stack effect metadata for pseudo instructions from bytecodes.c.
:func:`complex` accepts now a string only as a positional argument. Passing a complex number as the "real" or "imag" argument is deprecated; it should only be passed as a single positional argument.
Add a clear
command to the REPL. Patch by Pablo Galindo
Fix the signature of :meth:`str.format_map`.
An invalid assert in beta 1 has been removed. The assert would fail if
PyState_FindModule()
was used in an extension module's init function
before the module def had been initialized.
Fix deadlock during thread deletion in free-threaded build, which could occur when the GIL was enabled at runtime.
Fix deadlock involving _PyType_Lookup()
cache in the free-threaded build
when the GIL is dynamically enabled at runtime.
Eliminate type version guards in the tier two interpreter.
Note that setting the tp_version_tag
manually (which has never been
supported) may result in crashes.
Fix bug where names are unexpectedly mangled in the bases of generic classes.
Fix bug where names appearing after a generic class are mangled as if they are in the generic class.
Correct invalid corner cases in complex division (resulted in (nan+nanj)
output), e.g. 1/complex('(inf+infj)')
. Patch by Sergey B Kirpichev.
Evaluation of annotations is now deferred. See PEP 649 for details.
Replace :opcode:`!LOAD_ASSERTION_ERROR` opcode with :opcode:`LOAD_COMMON_CONSTANT` and add support for :exc:`NotImplementedError`.
Non-builtin modules built with argument clinic were crashing if used in a subinterpreter before the main interpreter. The objects that were causing the problem by leaking between interpreters carelessly have been fixed.
Fixes type.__type_params__
to return an empty tuple instead of a
descriptor.
Avoid creating unnecessary :exc:`StopIteration` instances for monitoring.
Add an __annotate__
attribute to functions, classes, and modules as part
of PEP 649. Patch by Jelle Zijlstra.
Fix displaying the source line for warnings created by the C API if the :mod:`warnings` module had not yet been imported.
Improve :exc:`ZeroDivisionError` error message. Now, all error messages are
harmonized: all /
, //
, and %
operations just use "division by
zero" message. And 0 ** -1
operation uses "zero to a negative power".
Fix build failures when configuring with both --disable-gil
and
--enable-experimental-jit
.
Add copy()
method for FrameLocalsProxy
which returns a snapshot
dict
for local variables.
Fix data races on the field that stores a pointer to the interpreter's main thread that occur in free-threaded builds.
If the C version of the decimal
module is available, int(str)
now
uses it to supply an asymptotically much faster conversion. However, this
only applies if the string contains over about 2 million digits.
Using :data:`NotImplemented` in a boolean context now raises :exc:`TypeError`. Contributed by Jelle Zijlstra.
Fix race condition in free-threaded build where :meth:`!list.extend` could expose uninitialised memory to concurrent readers.
Convert the Python evaluation stack to use internal stack references. The purpose is to support tagged pointers. In PEP 703, this will allow for its form of deferred reference counting. For both the default and free-threaded builds, this sets up the infrastructure for unboxed integers in the future.
Raise TypeError
when passing a string to :func:`difflib.unified_diff`
and :func:`difflib.context_diff`.
Improve error messages when a string, bytes or bytearray object of length 1 is expected.
Avoid assertion failure for debug builds when calling
object.__sizeof__(1)
Improve the :meth:`~object.__repr__` output of :class:`~ast.AST` nodes.
Changed the error message for awaiting something that can't be awaited from "object <type> can't be used in an await expression" to "'<type>' object can't be awaited".
:c:func:`Py_Finalize` now deletes all interned strings.
Add class methods :meth:`float.from_number` and :meth:`complex.from_number`.
Improve the error message from a in b
when b
is not a container to
mention the term "container".
Fix handling of doc
argument to subclasses of property
.
Convert the :ref:`curses.window <curses-window-objects>` static type exposed
by the :c:macro:`!PyCursesWindow_Type` macro in Include/py_curses.h
to a
:ref:`heap type <heap-types>`. Patch by Bénédikt Tran.
Add :c:func:`PyUnicode_Equal` function to the limited C API: test if two strings are equal. Patch by Victor Stinner.
:c:type:`PyDictObject` no longer maintains a private version tag field
ma_version_tag
per PEP 699. This field was originally added in
Python 3.6 (PEP 509) and deprecated in Python 3.12.
Fix crash when importing modules containing state and single-phase initialization in a subinterpreter.
Add :c:func:`PyType_GetBaseByToken` and :c:data:`Py_tp_token` slot for easier type checking, related to PEP 489 and PEP 630.
In the limited C API 3.14 and newer, :c:func:`Py_REFCNT` is now implemented as an opaque function call to hide implementation details. Patch by Victor Stinner.
Fixed a bug that prevented circular imports of extension modules that use single-phase initialization.
:c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` and :c:func:`PyType_FromModuleAndSpec` will now fail if the metaclass of the new type has custom :c:member:`~PyTypeObject.tp_new`.
Add functions to configure the Python initialization (PEP 741):
- :c:func:`PyInitConfig_Create`
- :c:func:`PyInitConfig_Free`
- :c:func:`PyInitConfig_GetError`
- :c:func:`PyInitConfig_GetExitCode`
- :c:func:`PyInitConfig_HasOption`
- :c:func:`PyInitConfig_GetInt`
- :c:func:`PyInitConfig_GetStr`
- :c:func:`PyInitConfig_GetStrList`
- :c:func:`PyInitConfig_FreeStrList`
- :c:func:`PyInitConfig_SetInt`
- :c:func:`PyInitConfig_SetStr`
- :c:func:`PyInitConfig_SetStrList`
- :c:func:`PyInitConfig_AddModule`
- :c:func:`Py_InitializeFromInitConfig`
Patch by Victor Stinner.
Add functions to get and set the current runtime Python configuration:
Patch by Victor Stinner.
:c:macro:`Py_RELATIVE_OFFSET` is now allowed in :c:type:`PyMemberDef` for
the special offset member "__vectorcalloffset__"
, as well as the
discouraged special offset members "__dictoffset__"
and
"__weaklistoffset__"
Added a slot Py_tp_vectorcall
to set
:c:member:`~PyTypeObject.tp_vectorcall` via the :c:func:`PyType_FromSpec`
function family. Limited API extensions can use this feature to provide more
efficient vector call-based implementation of __new__
and __init__
.
Add :c:func:`Py_HashBuffer` to compute and return the hash value of a buffer. Patch by Antoine Pitrou and Victor Stinner.
Fix :c:func:`PyEval_GetLocals` to avoid :exc:`SystemError` ("bad argument to internal function"). Patch by Victor Stinner.
Make :any:`PyObject_Print` work around a bug in Android and OpenBSD which prevented it from throwing an exception when trying to write to a read-only stream.
Add :c:func:`PyIter_NextItem` to replace :c:func:`PyIter_Next`, which has an ambiguous return value. Patch by Irit Katriel and Erlend Aasland.
Export private :c:func:`!_PyBytes_Join` again.
Add :c:func:`PyBytes_Join(sep, iterable) <PyBytes_Join>` function, similar
to sep.join(iterable)
in Python. Patch by Victor Stinner.
Export the :c:func:`PySignal_SetWakeupFd` function. Previously, the function was documented but it couldn't be used in 3rd party code. Patch by Victor Stinner.
:c:func:`PyUnicode_InternInPlace` no longer prevents its argument from being garbage collected.
Several functions that take char *
are now documented as possibly
preventing string objects from being garbage collected; refer to their
documentation for details: :c:func:`PyUnicode_InternFromString`,
:c:func:`PyDict_SetItemString`, :c:func:`PyObject_SetAttrString`,
:c:func:`PyObject_DelAttrString`, :c:func:`PyUnicode_InternFromString`, and
PyModule_Add*
convenience functions.
Removed debug build assertions related to interning strings, which were falsely triggered by stable ABI extensions.
Restore the private _PyArg_Parser
structure and the private
_PyArg_ParseTupleAndKeywordsFast()
function, previously removed in
Python 3.13 alpha 1. Patch by Victor Stinner.
Remove the private _Py_CODEUNIT
type from the public C API. The internal
pycore_code.h
header should now be used to get this internal type. Patch
by Victor Stinner.
:c:func:`PyDict_Next` no longer locks the dictionary in the free-threaded build. The locking needs to be done by the caller around the entire iteration loop.
Remove the following unstable functions:
PyUnstable_Replace_Executor()
PyUnstable_SetOptimizer()
PyUnstable_GetOptimizer()
PyUnstable_GetExecutor()
PyUnstable_Optimizer_NewCounter()
PyUnstable_Optimizer_NewUOpOptimizer()
Patch by Victor Stinner.
Add new functions to convert C <stdint.h>
numbers from/to Python
:class:`int`:
- :c:func:`PyLong_FromInt32`
- :c:func:`PyLong_FromUInt32`
- :c:func:`PyLong_FromInt64`
- :c:func:`PyLong_FromUInt64`
- :c:func:`PyLong_AsInt32`
- :c:func:`PyLong_AsUInt32`
- :c:func:`PyLong_AsInt64`
- :c:func:`PyLong_AsUInt64`
Patch by Victor Stinner.
In the limited C API 3.14 and newer, :c:func:`Py_TYPE` is now implemented as an opaque function call to hide implementation details. Patch by Victor Stinner.
:c:func:`PyUnicode_FromFormat` no longer produces the ending \ufffd
character for truncated C string when use precision with %s
and %V
.
It now truncates the string before the start of truncated multibyte
sequences.
Set :data:`errno` in :c:func:`_Py_c_pow` on overflows. Patch by Sergey B Kirpichev.
Add a new :c:type:`PyUnicodeWriter` API to create a Python :class:`str` object:
- :c:func:`PyUnicodeWriter_Create`.
- :c:func:`PyUnicodeWriter_Discard`.
- :c:func:`PyUnicodeWriter_Finish`.
- :c:func:`PyUnicodeWriter_WriteChar`.
- :c:func:`PyUnicodeWriter_WriteUTF8`.
- :c:func:`PyUnicodeWriter_WriteUCS4`.
- :c:func:`PyUnicodeWriter_WriteWideChar`.
- :c:func:`PyUnicodeWriter_WriteStr`.
- :c:func:`PyUnicodeWriter_WriteRepr`.
- :c:func:`PyUnicodeWriter_WriteSubstring`.
- :c:func:`PyUnicodeWriter_Format`.
- :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`.
Patch by Victor Stinner.
Soft deprecate the :c:macro:`!Py_MEMCPY` macro: use directly memcpy()
instead. Patch by Victor Stinner.
Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable bases was deprecated since 3.12 and now raises a :exc:`TypeError`.
Fix crash when a thread state that was created by :c:func:`PyGILState_Ensure` calls a destructor that during :c:func:`PyThreadState_Clear` that calls back into :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`. This might occur when in the free-threaded build or when using thread-local variables whose destructors call :c:func:`PyGILState_Ensure`.
Macros Py_IS_NAN
, Py_IS_INFINITY
and Py_IS_FINITE
are
:term:`soft deprecated`.
Restore the removed _PyLong_NumBits()
function. It is used by the
pywin32 project. Patch by Ethan Smith
The critical section API is now public as part of the non-limited C API.
Add :c:func:`PyContext_AddWatcher` and :c:func:`PyContext_ClearWatcher` APIs to register callbacks to receive notification on enter and exit of context objects.
Added Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST
and
Py_END_CRITICAL_SECTION_SEQUENCE_FAST
macros to make it possible to use
PySequence_Fast APIs safely when free-threaded, and update str.join to work
without the GIL using them.
Add :c:macro:`PyHASH_MULTIPLIER` constant: prime multiplier used in string and various other hashes. Patch by Victor Stinner.
Several C declarations with names that didn't start with the Py
or
_Py
prefixes, which were added by mistake in 3.13 alpha and beta
releases, were moved to internal headers.
Make mimalloc includes relative to the current file to avoid embedders or
extensions needing to include Internal/mimalloc
if they are already
including internal CPython headers.
Add :c:func:`PyUnstable_Object_ClearWeakRefsNoCallbacks`, which clears weakrefs without calling their callbacks.
Restore _PyWeakref_ClearRef
that was previously removed in Python 3.13
alpha 1.
Make the :c:type:`PyMutex` public in the non-limited C API.
Add :c:func:`PyLong_GetSign` function. Patch by Sergey B Kirpichev.
Fix creating bitfields in :mod:`ctypes` structures and unions. Fields no longer overlap.
Attempting to acquire the GIL after runtime finalization has begun in a different thread now causes the thread to hang rather than terminate, which avoids potential crashes or memory corruption caused by attempting to terminate a thread that is running code not specifically designed to support termination. In most cases this hanging is harmless since the process will soon exit anyway.
The PyThread_exit_thread
function is now deprecated. Its behavior is
inconsistent across platforms, and it can only be used safely in the
unlikely case that every function in the entire call stack has been designed
to support the platform-dependent termination mechanism. It is recommended
that users of this function change their design to not require thread
termination. In the unlikely case that thread termination is needed and can
be done safely, users may migrate to calling platform-specific APIs such as
pthread_exit
(POSIX) or _endthreadex
(Windows) directly.
Added Py_IsInitialized
to the list of APIs that are safe to call before
the interpreter is initialized, and updated the embedding tests to cover it.
Fix detection of whether -latomic
is needed when cross-compiling CPython
using the configure script.
Remove WITH_FREELISTS
macro and --without-freelists
build
configuration
Update internal documentation under PCbuild, so it now correctly states that Windows requires VS2017 or later and Python 3.10 or later
Building using :option:`--with-trace-refs` is (temporarily) disallowed when the GIL is disabled.
Updated Android build to use OpenSSL 3.0.15.
Propagate the value of LDFLAGS
to LDCXXSHARED
in :mod:`sysconfig`.
Patch by Pablo Galindo
Allow for specifying the target compile triple for WASI.
Use WASI SDK 24 for testing.
Rename build variable MODULE_LDFLAGS
back to LIBPYTHON
, as it's used
by package build systems (e.g. Meson).
Fix an issue where the experimental JIT could be built several times by the
make regen-all
target, leading to possible race conditions on heavily
parallelized builds.
Introduce ./configure --disable-safety and --enable-slower-safety options. Patch by Donghee Na.
Added a :option:`--with-app-store-compliance` option to patch out known issues with macOS/iOS App Store review processes.
Support WASI SDK 22 by explicitly skipping functions that are just stubs in wasi-libc.
Fix mimalloc compile error on GNU/Hurd
Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc.
Fix a Makefile bug that prevented mimalloc header files from being installed.
On POSIX systems, excluding macOS framework installs, the lib directory for the free-threaded build now includes a "t" suffix to avoid conflicts with a co-located default build installation.
The default minimum iOS version was increased to 13.0.
Fix build failure when the developer use --enable-pystats
arguments in
configuration command after #118450.
Fix failing configure tests due to a missing space when appending to CFLAGS.
Correctly handle LLVM installs with LLVM_VERSION_SUFFIX
when building
with --enable-experimental-jit
.
On WASI in debug mode, Python is now built with compiler flag -O3
instead of -Og
, to support more recursive calls. Patch by Victor
Stinner.
Fix a possible race condition affecting parallel builds configured with
--enable-experimental-jit
, in which :exc:`FileNotFoundError` could be
caused by another process already moving jit_stencils.h.new
to
jit_stencils.h
.
On Windows, fix build error when --disable-gil
and
--experimental-jit
options are combined.
Make the python-config
shell script compatible with non-bash shells.
Improve :mod:`curses` and :mod:`curses.panel` dependency checks in :program:`configure`.
On POSIX systems, the pkg-config (.pc
) filenames now include the ABI
flags, which may include debug ("d") and free-threaded ("t"). For example:
* python-3.14.pc
(default, non-debug build) * python-3.14d.pc
(default, debug build) * python-3.14t.pc
(free-threaded build)
make_ssl_certs
, the script that prepares certificate data for the test
suite, now allows specifying expiration dates.
Fall back to the bundled libmpdec if a system version cannot be found.
Update :data:`sys.version` to identify whether the build is default build or free-threading build. Patch By Donghee Na.
Fix an AssertionError
when building with --enable-experimental-jit
and the compiler emits a SHT_NOTE
section.
Fix a possible race condition affecting parallel builds configured with
--enable-experimental-jit
, in which compilation errors could be caused
by an incompletely-generated header file.