Don't include comments in f-string debug expressions. Patch by Pablo Galindo
Slightly optimize the Tier 2 (uop) interpreter by only loading oparg
and
operand
when needed. Also double the trace size limit again, to 512 this
time.
Change docstrings of :attr:`~object.__dict__` and :attr:`~object.__weakref__`.
Lower the max parser stack depth to 1000 under WASI debug builds.
When Python is built in debug mode, set the C recursion limit to 500 instead of 1500. A debug build is likely built with low optimization level which implies higher stack memory usage than a release build. Patch by Victor Stinner.
Enable translating unspecialized FOR_ITER
to Tier 2.
Make hashlib related modules thread-safe without the GIL
Deprecate assignment to a function's __code__
field when the new code
object is of a mismatched type (e.g., from a generator to a plain function).
Raise exception if :meth:`frame.clear` is called on a suspended frame.
Implement native thread ids for GNU KFreeBSD.
Use exponential backoff to reduce the number of failed tier 2 optimization attempts by over 99%.
Joining a thread now ensures the underlying OS thread has exited. This is required for safer fork() in multi-threaded processes.
Make sure that tier 2 traces are de-optimized if the code is instrumented
Specialize slot loads and stores for _Py_T_OBJECT as well as Py_T_OBJECT_EX
Speed up :meth:`BaseExceptionGroup.derive`, :meth:`BaseExceptionGroup.subgroup`, and :meth:`BaseExceptionGroup.split` by changing how they parse passed arguments.
Fix runtime crash when some error happens in opcode
LOAD_FROM_DICT_OR_DEREF
.
Add support for sharing tuples between interpreters using the cross-interpreter API. Patch by Anthony Shaw.
The oparg of :opcode:`YIELD_VALUE` is now 1
if the instruction is part
of a yield-from or await, and 0
otherwise.
The SUSPENDED frame state is now split into SUSPENDED
and
SUSPENDED_YIELD_FROM
. This simplifies the code in _PyGen_yf
.
Merge the Tier 1 (bytecode) and Tier 2 (micro-ops) interpreters together,
moving the Tier 2 interpreter loop and switch into
_PyEval_EvalFrameDefault()
in Python/ceval.c
. The
Python/executor.c
file is gone. Also the TIER_ONE
and TIER_TWO
macros are now handled by the code generator.
Beware! This changes the environment variables to enable micro-ops and
their debugging to PYTHON_UOPS
and PYTHON_LLTRACE
.
Speed up :class:`Traceback` object creation by lazily compute the line number. Patch by Pablo Galindo
Allow type comments in parenthesized with
statements
Add support for sharing floats between interpreters using the cross-interpreter API. Patch by Anthony Shaw.
Add support for sharing of True
and False
between interpreters using the
cross-interpreter API. Patch by Anthony Shaw.
Fix a bug where iso2022_jp_3
and iso2022_jp_2004
codecs read out of
bounds
Fix an issue in the :mod:`codeop` that was causing :exc:`SyntaxError` exceptions raised in the presence of invalid syntax to not contain precise error messages. Patch by Pablo Galindo
Fix a bug that was causing :exc:`SyntaxWarning` to appear twice when parsing if invalid syntax is encountered later. Patch by Pablo galindo
Added a new environment variable :envvar:`PYTHON_FROZEN_MODULES`. It determines whether or not frozen modules are ignored by the import machinery, equivalent of the :option:`-X frozen_modules <-X>` command-line option.
Remove oparg
from :opcode:`YIELD_VALUE`. Change oparg
of
:opcode:`RESUME` to include information about the except-depth. These
changes make it possible to simplify the code in generator close.
Fix a regression that prevented jumping across is None
and is not
None
when debugging. Patch by Savannah Ostrowski.
Show source lines in tracebacks when using the -c
option when running
Python. Patch by Pablo Galindo
Fix a bug where a :keyword:`global` declaration in an :keyword:`except` block is rejected when the global is used in the :keyword:`else` block.
Fix error messages for indented blocks with functions and classes with generic type parameters. Patch by Pablo Galindo
Remove unnecessary instruction pointer updates before returning from frames.
Correctly display the traceback for :exc:`MemoryError` exceptions using the :mod:`traceback` module. Patch by Pablo Galindo
Fixed crash due to improperly initialized static :exc:`MemoryError` in subinterpreter.
Return NULL
for PyTrace_RETURN
events caused by an exception
Fix argument parsing by _PyArg_UnpackKeywordsWithVararg
for functions
defining pos-or-keyword, vararg, and kw-only parameters.
Replace prev_instr
on the interpreter frame by instr_ptr
which
points to the beginning of the instruction that is currently executing (or
will execute once the frame resumes).
Allow the repl to show source code and complete tracebacks. Patch by Pablo Galindo
Add :envvar:`PYTHON_PRESITE=package.module` to import a module early in the
interpreter lifecycle before site.py
is executed. Python needs to be
:ref:`built in debug mode <debug-build>` for this option to exist.
Implement biased reference counting in --disable-gil
builds.
Fix regression in Python 3.12 where :meth:`types.CodeType.replace` would produce a broken code object if called on a module or class code object that contains a comprehension. Patch by Jelle Zijlstra.
Removed chained :class:`classmethod` descriptors (introduced in :issue:`19072`). This can no longer be used to wrap other descriptors such as :class:`property`. The core design of this feature was flawed and caused a number of downstream problems. To "pass-through" a :class:`classmethod`, consider using the :attr:`!__wrapped__` attribute that was added in Python 3.10.
Use local events for opcode tracing
Add mimalloc memory allocator support.
When PyConfig.stdlib_dir is explicitly set, it's now respected and won't be overridden by PyConfig.home.
Fix incorrect SystemError about AST constructor recursion depth mismatch.
Improve error message for unterminated strings with escapes.
Improved error messages for elif
/else
statements not matching any
valid statements. Patch by Jeremiah Vivian.
Fix SystemError in the TextIOWrapper constructor with non-encodable "errors" argument in non-debug mode.
Added the NI_IDN
constant to the :mod:`socket` module when present in C
at build time for use with :func:`socket.getnameinfo`.
Issue warning message instead of having :class:`RuntimeError` be displayed when event loop has already been closed at :meth:`StreamWriter.__del__`.
Fix crashes in :meth:`io.TextIOWrapper.reconfigure` when pass invalid arguments, e.g. non-string encoding.
:mod:`curses`: restore wide character support (including :func:`curses.unget_wch` and :meth:`~curses.window.get_wch`) on macOS, which was unavailable due to a regression in Python 3.12.
:class:`contextlib.suppress` now supports suppressing exceptions raised as part of a :exc:`BaseExceptionGroup`, in addition to the recent support for :exc:`ExceptionGroup`.
The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.seekable` method that can be used when a seekable file-like object is required. The :meth:`~mmap.mmap.seek` method now returns the new absolute position. Patch by Donghee Na.
Remove posix.fallocate() under WASI as the underlying posix_fallocate() is not available in WASI preview2.
Fix truncating arguments on an embedded null character in :meth:`os.putenv` and :meth:`os.unsetenv` on Windows.
:func:`wsgiref.util.is_hop_by_hop` is now exposed correctly in __all__
.
Avoid executing the default function in :class:`cmd.Cmd` in an except block
Fix :mod:`doctest` for :exc:`SyntaxError` not-builtin subclasses.
Add extra argument validation for alias
command in :mod:`pdb`
:mod:`time`: Make :func:`time.clock_gettime` and :func:`time.clock_gettime_ns` functions up to 2x faster by faster calling convention. Patch by Victor Stinner.
Call loop exception handler for exceptions in client_connected_cb
of
:func:`asyncio.start_server` so that applications can handle it. Patch by
Kumar Aditya.
Fix reference leaks in bind_class()
and bind_all()
methods of
:mod:`tkinter` widgets.
:meth:`asyncio.loop.create_unix_server` will now automatically remove the Unix socket when the server is closed.
Added :func:`io.text_encoding`, :data:`io.DEFAULT_BUFFER_SIZE`, and
:class:`io.IncrementalNewlineDecoder` to io.__all__
.
Remove the code to set the REMOTE_HOST header from wsgiref module, as it is unreachable. This header is used for performance reasons, which is not necessary in the wsgiref module.
Speed up :meth:`pathlib.PurePath.relative_to` and :meth:`~pathlib.PurePath.is_relative_to`.
Fixed typo in :func:`math.sumprod`.
Remove mention of not supported "vsapi" element type in
:meth:`tkinter.ttk.Style.element_create`. Add tests for element_create()
and other ttk.Style
methods. Add examples for element_create()
in
the documentation.
Add show_group
parameter to :func:`traceback.format_exception_only`,
which allows to format :exc:`ExceptionGroup` instances.
Another attempt at fixing :func:`asyncio.Server.wait_closed`. It now blocks until both conditions are true: the server is closed, and there are no more active connections. (This means that in some cases where in 3.12.0 this function would incorrectly have returned immediately, it will now block; in particular, when there are no active connections but the server hasn't been closed yet.)
Optimize recursive wildcards in :mod:`pathlib`.
Fix :mod:`time` not checking for errors when initializing.
Add error checking during :mod:`!_socket` module init.
Fix :mod:`!_blake2` not checking for errors when initializing.
Fix :mod:`select` not checking for errors when initializing.
Fix :mod:`ssl` not checking for errors when initializing.
Fix crash in :meth:`io.BytesIO.getbuffer` called repeatedly for empty BytesIO.
Postpone removal version for locale.getdefaultlocale() to Python 3.15.
Fix :mod:`doctest` output comparison for exceptions with notes.
Fix invalid state handling in :class:`asyncio.TaskGroup` and :class:`asyncio.Timeout`. They now raise proper RuntimeError if they are improperly used and are left in consistent state after this.
Make turtledemo run without default root enabled.
Support alias and convenience vars for :mod:`pdb` completion
Added newline parameter to :meth:`pathlib.Path.read_text`. Patch by Junya Okabe.
Make :mod:`pdb` enter post-mortem mode even for :exc:`SyntaxError`
Set f_trace_lines = True
on all frames upon :func:`pdb.set_trace`
Expose the setup and cleanup portions of asyncio.run_forever()
as the
standalone methods asyncio.run_forever_setup()
and
asyncio.run_forever_cleanup()
. This allows for tighter integration with
GUI event loops.
Support setting the :class:`asyncio.Runner` loop_factory kwarg in :class:`unittest.IsolatedAsyncioTestCase`
Fix :func:`tty.setraw` and :func:`tty.setcbreak`: previously they returned partially modified list of the original tty attributes. :func:`tty.cfmakeraw` and :func:`tty.cfmakecbreak` now make a copy of the list of special characters before modifying it.
Make line number of function breakpoint more precise in :mod:`pdb`
Emit deprecation warning for non-integer numbers in :mod:`gettext` functions and methods that consider plural forms even if the translation was not found.
Ensure that :func:`select.kqueue` objects correctly appear as closed in forked children, to prevent operations on an invalid file descriptor.
Add __reduce__
method to :class:`IPv6Address` in order to keep
scope_id
Improve errors for unsupported look-behind patterns. Now re.error is raised instead of OverflowError or RuntimeError for too large width of look-behind pattern.
Add the :attr:`ipaddress.IPv4Address.ipv6_mapped` property, which returns the IPv4-mapped IPv6 address.
Implement the CLI of the :mod:`symtable` module and improve the repr of :class:`~symtable.Symbol`.
Improved error handling in :mod:`pdb` command line interface, making it produce more concise error messages.
Change :mod:`compileall` to only strip the stripdir prefix from the full
path recorded in the compiled .pyc
file, when the prefix matches the
start of the full path in its entirety. When the prefix does not match, no
stripping is performed and a warning to this effect is displayed.
Previously all path components of the stripdir prefix that matched the full path were removed, while those that did not match were left alone (including ones interspersed between matching components).
Make the DictProxy
and ListProxy
types in
:mod:`multiprocessing.managers` :ref:`Generic Alias
Types<types-genericalias>` for []
use in typing contexts.
Add :func:`glob.translate`. This function converts a pathname with shell-style wildcards to a regular expression.
Define USE_XATTRS
on Cygwin so that XATTR-related functions in the
:mod:`os` module become available.
New methods :meth:`mailbox.Maildir.get_info`, :meth:`mailbox.Maildir.set_info`, :meth:`mailbox.Maildir.get_flags`, :meth:`mailbox.Maildir.set_flags`, :meth:`mailbox.Maildir.add_flag`, :meth:`mailbox.Maildir.remove_flag`. These methods speed up accessing a message's info and/or flags and are useful when it is not necessary to access the message's contents, as when iterating over a Maildir to find messages with specific flags.
Fix returning of empty byte strings after seek in zipfile module
Added a parameter local_exit
for :func:`code.interact` to prevent
exit()
and quit
from closing sys.stdin
and raise SystemExit
.
Change the behavior of :meth:`tkinter.Text.count`. It now always returns an
integer if one or less counting options are specified. Previously it could
return a single count as a 1-tuple, an integer (only if option "update"
was specified) or None
if no items found. The result is now the same if
wantobjects
is set to 0
.
Switch the storage of the unicode codepoint names to use a different data-structure, a directed acyclic word graph. This makes the unicodedata shared library about 440 KiB smaller. Contributed by Carl Friedrich Bolz-Tereick using code from the PyPy project.
Omit the interface scope from an IPv6 address when used as Host header by :mod:`http.client`.
:mod:`zipinfo` now supports the full range of values in the TZ string determined by RFC 8536 and detects all invalid formats. Both Python and C implementations now raise exceptions of the same type on invalid data.
Make the default value of test.support.infinite_recursion()
to be
conditional based on whether optimizations were used when compiling the
interpreter. This helps with platforms like WASI whose stack size is greatly
restricted in debug builds.
Gathering line coverage of standard libraries within the regression test suite is now precise, as well as much faster. Patch by Łukasz Langa.
Make regrtest --verbose3
option compatible with --huntrleaks -jN
options. The ./python -m test -j1 -R 3:3 --verbose3
command now works as
expected. Patch by Victor Stinner.
Remove no longer used functions run_unittest()
and run_doctest()
from the :mod:`test.support` module.
Fix regrtest if the SOURCE_DATE_EPOCH
environment variable is defined:
use the variable value as the random seed. Patch by Victor Stinner.
test_gdb: Fix detection of gdb built without Python scripting support. Patch by Victor Stinner.
Test case matching patterns specified by options --match
, --ignore
,
--matchfile
and --ignorefile
are now tested in the order of
specification, and the last match determines whether the test case be run or
ignored.
Add unit test for usercustomize
and sitecustomize
hooks from
:class:`site`.
Make make regen-unicodedata
work for out-of-tree builds of CPython.
Add Tools/build/regen-configure.sh
script to regenerate the
configure
with an Ubuntu container image. The
quay.io/tiran/cpython_autoconf:271
container image
(tiran/cpython_autoconf) is
no longer used. Patch by Victor Stinner.
For wasi-threads, memory is now exported to fix compatibility issues with some wasm runtimes.
AIX 32bit needs -latomic
to build the :mod:`!_testcapi` extension
module.
The errno
, md5
, resource
, winsound
, _ctypes_test
,
_multiprocessing.posixshmem
, _scproxy
, _stat
,
_testimportmultiple
and _uuid
C extensions are now built with the
:ref:`limited C API <limited-c-api>`. Patch by Victor Stinner.
Fixes :func:`~os.fstat` on file systems that do not support file ID requests. This includes FAT32 and exFAT.
Fix :data:`os.DirEntry.inode` dropping higher 64 bits of a file id on some filesystems on Windows.
WindowsConsoleIO now correctly chunks large buffers without splitting up UTF-8 sequences.
For macOS framework builds, in getpath.c
use the system dladdr
function to find the path to the shared library rather than depending on
deprecated macOS APIs.
Update macOS installer to include an upstream Tcl/Tk fix for the Secure
coding is not enabled for restorable state!
warning encountered in Tkinter
on macOS 14 Sonoma.
Ensure that IDLE.app and Python Launcher.app are installed with appropriate permissions on macOS builds.
Update macOS installer to include an upstream Tcl/Tk fix for the
ttk::ThemeChanged
error encountered in Tkinter.
Update macOS installer to include a fix accepted by upstream Tcl/Tk for a crash encountered after the first :meth:`tkinter.Tk` instance is destroyed.
Add docstrings to the IDLE debugger module. Fix two bugs: initialize
Idb.botframe
(should be in Bdb); in Idb.in_rpc_code
, check whether
prev_frame
is None
before trying to use it. Greatly expand test_debugger.
Argument Clinic now supports the @critical_section
directive that
instructs Argument Clinic to generate a critical section around the function
call, which locks the self
object in --disable-gil
builds. Patch by
Sam Gross.
Add again the private _PyThreadState_UncheckedGet()
function as an alias
to the new public :c:func:`PyThreadState_GetUnchecked` function. Patch by
Victor Stinner.
Restore the removed _PyDict_GetItemStringWithError()
function. It is
used by numpy. Patch by Victor Stinner.
Restore removed private C API functions, macros and structures which have no simple replacement for now:
- _PyDict_GetItem_KnownHash()
- _PyDict_NewPresized()
- _PyHASH_BITS
- _PyHASH_IMAG
- _PyHASH_INF
- _PyHASH_MODULUS
- _PyHASH_MULTIPLIER
- _PyLong_Copy()
- _PyLong_FromDigits()
- _PyLong_New()
- _PyLong_Sign()
- _PyObject_CallMethodId()
- _PyObject_CallMethodNoArgs()
- _PyObject_CallMethodOneArg()
- _PyObject_CallOneArg()
- _PyObject_EXTRA_INIT
- _PyObject_FastCallDict()
- _PyObject_GetAttrId()
- _PyObject_Vectorcall()
- _PyObject_VectorcallMethod()
- _PyStack_AsDict()
- _PyThread_CurrentFrames()
- _PyUnicodeWriter structure
- _PyUnicodeWriter_Dealloc()
- _PyUnicodeWriter_Finish()
- _PyUnicodeWriter_Init()
- _PyUnicodeWriter_Prepare()
- _PyUnicodeWriter_PrepareKind()
- _PyUnicodeWriter_WriteASCIIString()
- _PyUnicodeWriter_WriteChar()
- _PyUnicodeWriter_WriteLatin1String()
- _PyUnicodeWriter_WriteStr()
- _PyUnicodeWriter_WriteSubstring()
- _PyUnicode_AsString()
- _PyUnicode_FromId()
- _PyVectorcall_Function()
- _Py_IDENTIFIER()
- _Py_c_abs()
- _Py_c_diff()
- _Py_c_neg()
- _Py_c_pow()
- _Py_c_prod()
- _Py_c_quot()
- _Py_c_sum()
- _Py_static_string()
- _Py_static_string_init()
Patch by Victor Stinner.
Add again <ctype.h>
and <unistd.h>
includes in Python.h
, but
don't include them in the limited C API version 3.13 and newer. Patch by
Victor Stinner.
Add internal-only one-time initialization API: _PyOnceFlag
and
_PyOnceFlag_CallOnce
.
Add :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions: remove a key from a dictionary and optionally return the removed value. This is similar to :meth:`dict.pop`, but without the default value and not raising :exc:`KeyError` if the key missing. Patch by Stefan Behnel and Victor Stinner.
Rename Py_NOGIL
to Py_GIL_DISABLED
. Patch by Hugo van Kemenade.
Add :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions: similar to
Python list.extend()
and list.clear()
methods. Patch by Victor
Stinner.
On Windows, Python.h
no longer includes the <stddef.h>
standard
header file. If needed, it should now be included explicitly. Patch by
Victor Stinner.
Implement "Python Critical Sections" from PEP 703. These are macros to
help replace the GIL with per-object locks in the --disable-gil
build of
CPython. The macros are no-ops in the default build.
In the limited C API version 3.13, :c:func:`Py_SET_REFCNT` function is now implemented as an opaque function call. Patch by Victor Stinner.
Add :c:func:`PyErr_FormatUnraisable` function.
Move the undocumented private _PyArg functions and _PyArg_Parser structure
to internal C API (pycore_modsupport.h
). Patch by Victor Stinner.
Support non-ASCII keyword names in :c:func:`PyArg_ParseTupleAndKeywords`.
Introduced :c:func:`PyUnstable_PerfTrampoline_CompileCode`, :c:func:`PyUnstable_PerfTrampoline_SetPersistAfterFork` and :c:func:`PyUnstable_CopyPerfMapFile`. These functions allow extension modules to initialize trampolines eagerly, after the application is "warmed up". This makes it possible to have perf-trampolines running in an always-enabled fashion.
Add the :c:func:`PySys_Audit` function to the limited C API. Patch by Victor Stinner.
Add :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawCalloc`, :c:func:`PyMem_RawRealloc` and :c:func:`PyMem_RawFree` to the limited C API. Patch by Victor Stinner.
Functions :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:`PySys_GetObject`, which clear all errors occurred during calling the function, report now them using :func:`sys.unraisablehook`.
Remove redundant C-contiguity check in :file:`getargs.c`, :mod:`binascii`, :mod:`ssl` and Argument Clinic. Patched by Stefan Krah and Furkan Onder