:c:func:`Py_EndInterpreter` now explicitly untracks all objects currently tracked by the GC. Previously, if an object was used later by another interpreter, calling :c:func:`PyObject_GC_UnTrack` on the object crashed if the previous or the next object of the :c:type:`!PyGC_Head` structure became a dangling pointer. Patch by Victor Stinner.
Fix memory leak in PyEval_EvalCodeEx.
Fix a crash in the parser when retrieving the error text for multi-line f-strings expressions that do not start in the first line of the string. Patch by Pablo Galindo
Do not set line number of instruction storing doc-string. Fixes regression introduced in 3.11 alpha.
Remove spurious "call" event when creating a lambda function that was accidentally introduced in 3.11a4.
ASDL declaration of FormattedValue
has changed to reflect conversion
field is not optional.
Fixed an interpreter crash on bootup with multiple PythonPaths set in the Windows registry. Patch by Derzsi Dániel.
Fix the line number of tokenizer errors inside f-strings. Patch by Pablo Galindo.
We always expect the "use_frozen_modules" config to be set, now that getpath.c was rewritten in pure Python and the logic improved.
Fix a regression when a type method like __init__()
is modified in a
subinterpreter. Fix a regression in _PyUnicode_EqualToASCIIId()
and type
update_slot()
. Revert the change which made the Unicode dictionary of
interned strings compatible with subinterpreters: the internal interned
dictionary is shared again by all interpreters. Patch by Victor Stinner.
Add RESUME opcode. This is a logical no-op. It is emitted by the compiler anywhere a Python function can be entered. It is used by the interpreter to perform tracing and optimizer checks.
Fix the regression of os.path.normpath("A/../../B") not returning expected "../B" but "B".
Correct the error message for unclosed parentheses when the tokenizer doesn't reach the end of the source when the error is reported. Patch by Pablo Galindo
Remove the GEN_START
opcode.
Certain sequence multiplication operations like [0] * 1_000
are now
faster due to reference-counting optimizations. Patch by Dennis Sweeney.
:opcode:`!PREP_RERAISE_STAR` no longer pushes lasti
to the stack.
Remove :opcode:`!POP_EXCEPT_AND_RERAISE` and replace it by an equivalent sequence of other opcodes.
Fix iterator cache mechanism of :class:`OrderedDict`.
Speed up shifting operation involving integers less than :c:macro:`PyLong_BASE`. Patch by Xinhang Xu.
Add a maximum recursion check to the PEG parser to avoid stack overflow. Patch by Pablo Galindo
Fix bug where :meth:`ExceptionGroup.split` and
:meth:`ExceptionGroup.subgroup` did not copy the exception group's
__note__
field to the parts.
The interpreter state's representation of handled exceptions (a.k.a
exc_info, or _PyErr_StackItem) now has only the exc_value
field,
exc_type
and exc_traceback
have been removed as their values can be
derived from exc_value
.
Replace the four call bytecode instructions which one pre-call instruction and two call instructions.
Removes CALL_FUNCTION
, CALL_FUNCTION_KW
, CALL_METHOD
and
CALL_METHOD_KW
.
Adds CALL_NO_KW
and CALL_KW
call instructions, and
PRECALL_METHOD
prefix for pairing with LOAD_METHOD
.
Remove the YIELD_FROM
instruction and replace it with the SEND
instruction which performs the same operation, but without the loop.
The code called from :c:func:`!_PyErr_Display` was refactored to improve error handling. It now exits immediately upon an unrecoverable error.
Fix parser error when parsing non-utf8 characters in source files. Patch by Pablo Galindo.
Improve the location of the caret in :exc:`SyntaxError` exceptions emitted by the symbol table. Patch by Pablo Galindo.
Ensure :file:`._pth` files work as intended on platforms other than Windows.
Fixes parsing of :file:`._pth` files on startup so that single-character paths are correctly read.
Fix a bug where the line numbers given in a traceback when a decorator application raised an exception were wrong.
Add :opcode:`POP_JUMP_IF_NOT_NONE` and :opcode:`POP_JUMP_IF_NONE` opcodes to speed up conditional jumps.
Deepfreeze :mod:`runpy`, patch by Kumar Aditya.
Fix a crash in the :mod:`atexit` module involving functions that unregister themselves before raising exceptions. Patch by Pablo Galindo.
Improve compatibility of the :mod:`curses` module with NetBSD curses.
Specialize the CALL_FUNCTION instruction for calls to builtin types with a
single argument. Speeds up range(x)
, list(x)
, and specifically
type(obj)
.
Fix bug where the built-in :func:`compile` function did not always raise a :exc:`SyntaxError` when passed multiple statements in 'single' mode. Patch by Weipeng Hong.
The main interpreter in _PyRuntimeState.interpreters is now statically allocated (as part of _PyRuntime). Likewise for the initial thread state of each interpreter. This means less allocation during runtime init, as well as better memory locality for these key state objects.
Complete the PEP 654 implementation: add except*
.
Revert changes in set.__init__
. Subclass of :class:`set` needs to define
a __init__()
method if it defines a __new__()
method with additional
keyword parameters.
Added the :c:data:`Py_Version` constant which bears the same value as :c:macro:`PY_VERSION_HEX`. Patch by Gabriele N. Tornetta.
The @typing.final
decorator now sets the __final__
attribute on the
decorated object to allow runtime introspection. Patch by Jelle Zijlstra.
Added the :meth:`sys.exception` method which returns the active exception instance.
Add :meth:`string.Template.is_valid` and :meth:`string.Template.get_identifiers` methods.
Assume that :class:`types.CodeType` always has :attr:`types.CodeType.co_firstlineno` in :mod:`doctest`.
Fix :mod:`hashlib` usedforsecurity option to work correctly with OpenSSL 3.0.0 in FIPS mode.
Fix possible segfault when importing the :mod:`asyncio` module from different sub-interpreters in parallel. Patch by Erlend E. Aasland.
Removed __slots__
from :class:`typing.ParamSpec` and
:class:`typing.TypeVar`. They served no purpose. Patch by Arie Bovenberg.
Reflect context
argument in AbstractEventLoop.call_*()
methods. Loop
implementations already support it.
Remove special-casing of __new__
in :meth:`enum.Enum.__dir__`.
Improve day constants in :mod:`calendar`.
Now all constants (MONDAY
... SUNDAY
) are documented, tested, and added
to __all__
.
Optimized the mean, variance, and stdev functions in the statistics module. If the input is an iterator, it is consumed in a single pass rather than eating memory by conversion to a list. The single pass algorithm is about twice as fast as the previous two pass code.
Added two new variables to pyvenv.cfg which is generated by :mod:`venv` module: executable for the executable and command for the command line used to create the environment.
Improve error message when importing :mod:`asyncio.windows_events` on non-Windows.
Reuse _winapi
constants in asyncio.windows_events
.
Adding SF_NOCACHE
sendfile constant for FreeBSD for the posixmodule.
Add fast path for 0 <= k <= n <= 67
for :func:`math.comb`.
Adding the MAP_STACK
constant for the mmap module.
Deprecate :attr:`webbrowser.MacOSXOSAScript._name` and use name
instead.
Added missing error codes to module xml.parsers.expat.errors
.
Refactor tests to test traversable API directly. Includes changes from importlib 5.4.0.
Moved importlib.resources and its related functionality to a package.
Add include_hidden parameter to :func:`~glob.glob` and :func:`~glob.iglob`
to match hidden files and directories when using special characters like
*
, **
, ?
and []
.
:func:`concurrent.futures.wait` no longer blocks forever when given duplicate Futures. Patch by Kumar Aditya.
Honor spec when generating requirement specs with urls and extras (importlib_metadata 4.8.3).
EntryPoint objects are no longer tuples. Recommended means to access is by attribute ('.name', '.group') or accessor ('.load()'). Access by index is deprecated and will raise deprecation warning.
Print unexpected successes together with failures and errors in summary in :class:`unittest.TextTestResult`.
Calling :meth:`add_argument_group` on an argument group is deprecated. Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` on a mutually exclusive group is deprecated.
These features were never supported and do not always work correctly. The functions exist on the API by accident through inheritance and will be removed in the future.
:mod:`argparse` raises :exc:`ValueError` with clear message when trying to render usage for an empty mutually exclusive group. Previously it raised a cryptic :exc:`IndexError`.
Functions in the :mod:`traceback` module raise :exc:`TypeError` rather than :exc:`AttributeError` when an exception argument is not of type :exc:`BaseException`.
Add allow allow_reuse_port flag in socketserver.
Fix help for the :mod:`signal` module. Some functions (e.g. signal()
and
getsignal()
) were omitted.
The registry()
method of :func:`functools.singledispatch` functions
checks now the first argument or the first parameter annotation and raises a
TypeError if it is not supported. Previously unsupported "types" were
ignored (e.g. typing.List[int]
) or caused an error at calling time (e.g.
list[int]
).
Add ability to use typing.Union
and types.UnionType
as dispatch
argument to functools.singledispatch
. Patch provided by Yurii Karabas.
Add :attr:`__all__` to :mod:`inspect`, patch by Kumar Aditya.
Ensure that :func:`math.expm1` does not raise on underflow.
Adding :const:`!F_DUP2FD` and :const:`!F_DUP2FD_CLOEXEC` constants from FreeBSD into the :mod:`fcntl` module.
:mod:`typing` generic aliases now reveal the class attributes of the
original generic class when passed to dir()
. This was the behavior up to
Python 3.6, but was changed in 3.7-3.9.
The empty query string, consisting of no query arguments, is now handled
correctly in urllib.parse.parse_qsl
. This caused problems before when
strict parsing was enabled.
Change how dataclasses disallows mutable default values. It used to use a list of known types (list, dict, set). Now it disallows unhashable objects to be defaults. It's using unhashability as a proxy for mutability. Patch by Eric V. Smith, idea by Raymond Hettinger.
Remove namespace package (PEP 420) support from unittest discovery. It was introduced in Python 3.4 but has been broken since Python 3.7.
Added a :meth:`__repr__` method to :class:`multiprocessing.Event` objects, patch by Kumar Aditya.
Added :const:`signal.SIGSTKFLT` on platforms where this signal is defined.
Fetch across rollback no longer raises :exc:`~sqlite3.InterfaceError`. Instead we leave it to the SQLite library to handle these cases. Patch by Erlend E. Aasland.
Replace concurrent.futures.TimeoutError
and asyncio.TimeoutError
with builtin :exc:`TimeoutError`, keep these names as deprecated aliases.
Document method :meth:`cmd.Cmd.columnize`.
State that |
is preferred for readability over Union
in the
:mod:`typing` docs.
Extracted importlib.resources
and importlib.resources.abc
documentation into separate files.
Update the documentation for the :func:`globals` function.
Add a test case for :mod:`enum` with _use_args_ == True
and
_member_type_ == object
.
Fix hang in runtest_mp due to race condition
Fix test_capi on FreeBSD 14-dev: instruct jemalloc to not fill freed memory with junk byte.
Cover ValueError
path in tests for :meth:`enum.Flag._missing_`.
Now fakename
in test_pathlib.PosixPathTest.test_expanduser
is
checked to be non-existent.
Rewrite asyncio.locks
tests with
:class:`unittest.IsolatedAsyncioTestCase` usage.
Fixed :mod:`asyncio` tests in python optimized mode. Patch by Kumar Aditya.
Fix test case for OpenSSL 3.0.1 version. OpenSSL 3.0 uses 0xMNN00PP0L
.
When Python is configured with :option:`--without-static-libpython`, the Python static library (libpython.a) is no longer built. Patch by Victor Stinner.
When Python is built without :option:`--enable-shared`, the python
program is now linked to object files, rather than being linked to the
Python static library (libpython.a), to make sure that all symbols are
exported. Previously, the linker omitted some symbols like the
:c:func:`Py_FrozenMain` function. Patch by Victor Stinner.
The configure
script has a new option --with-emscripten-target
to
select browser or node as Emscripten build target.
Added and fixed #ifdef HAVE_FEATURE
checks for functionality that is not
available on WASI platform.
Fixed a regression in configure
check for :func:`select.epoll`.
configure
no longer sets MULTIARCH
on FreeBSD platforms.
Updated OpenSSL to 1.1.1m in Windows builds, macOS installer builds, and CI. Patch by Kumar Aditya.
Automatically detect or install bootstrap Python runtime when building from Visual Studio.
Add a --with-pystats configure option to turn on internal statistics gathering.
A new directory Tools/wasm
contains WebAssembly-related helpers like
config.site
override for wasm32-emscripten, wasm assets generator to
bundle the stdlib, and a README.
:program:`makesetup` no longer builds extensions that have been marked as
disabled. This allows users to disable modules in Modules/Setup.local
.
Use pure Python freeze_module
for all but importlib bootstrap files.
--with-freeze-module
:program:`configure` option is no longer needed for
cross builds.
Removed parameter that is unsupported on Windows 8.1 and early Windows 10 and may have caused build or runtime failures.
The Python Launcher app for macOS now properly launches scripts and, if necessary, the Terminal app when running on recent macOS releases.
Fix a bug in :c:func:`PyFunction_GetAnnotations` that caused it to return a
tuple
instead of a dict
.
:c:func:`PyBuffer_GetPointer`, :c:func:`PyBuffer_FromContiguous`,
:c:func:`PyBuffer_ToContiguous` and :c:func:`PyMemoryView_FromBuffer` now
take buffer info by const Py_buffer *
instead of Py_buffer *
, as
they do not need mutability. :c:func:`PyBuffer_FromContiguous` also now
takes the source buffer as const void *
, and similarly
:c:func:`PyBuffer_GetPointer` takes the strides as const Py_ssize_t *
.
Document that the no_block argument to :c:func:`PyCapsule_Import` is a no-op now.
Replaced deprecated usage of :c:func:`PyImport_ImportModuleNoBlock` with :c:func:`PyImport_ImportModule` in stdlib modules. Patch by Kumar Aditya.
The :c:func:`!PyUnicode_CHECK_INTERNED` macro has been excluded from the limited C API. It was never usable there, because it used internal structures which are not available in the limited C API. Patch by Victor Stinner.