Fix multiplying a list by an integer (list *= int
): detect the integer
overflow when the new allocated length is close to the maximum size. Issue
reported by Jordan Limor. Patch by Victor Stinner.
On Linux the :mod:`multiprocessing` module returns to using filesystem backed unix domain sockets for communication with the forkserver process instead of the Linux abstract socket namespace. Only code that chooses to use the :ref:`"forkserver" start method <multiprocessing-start-methods>` is affected.
Abstract sockets have no permissions and could allow any user on the system in the same network namespace (often the whole system) to inject code into the multiprocessing forkserver process. This was a potential privilege escalation. Filesystem based socket permissions restrict this to the forkserver process user as was the default in Python 3.8 and earlier.
This prevents Linux :cve:`2022-42919`.
:mod:`http.server`: Fix an open redirection vulnerability in the HTTP server
when an URI path starts with //
. Vulnerability discovered, and initial
fix proposed, by Hamza Avvan.
LWPCookieJar and MozillaCookieJar create files with file mode 600 instead of 644 (Microsoft Windows is not affected)
Fix memoryview
use after free when accessing the backing buffer in
certain cases.
The deprecated mailcap module now refuses to inject unsafe text (filenames, MIME types, parameters) into shell commands. Instead of using such text, it will warn and act as if a match was not found (or for test commands, as if the test failed).
Suppress ImportError for invalid query for help() command. Patch by Donghee Na.
Fix source location in bytecode for list, set and dict comprehensions as well as generator expressions.
Added unicode check for name
attribute of spec
argument passed in
:func:`!_imp.create_builtin` function.
Fix source location of 'assert' bytecodes.
Fix location of sub-expressions of boolean expressions, by reducing their scope to that of the sub-expression.
Modules from the standard library are now potentially suggested as part of the error messages displayed by the interpreter when an :exc:`NameError` is raised to the top level. Patch by Pablo Galindo
Add running column offset to the tokenizer state to avoid calculating AST column information with pointer arithmetic.
Modify the tokenizer to return all necessary information the parser needs to set location information in the AST nodes, so that the parser does not have to calculate those doing pointer arithmetic.
:func:`os.sched_yield` now release the GIL while calling sched_yield(2). Patch by Donghee Na.
Migrate :mod:`zoneinfo` to Argument Clinic.
The compiler now avoids quadratic behavior when finding which instructions should use the :opcode:`LOAD_FAST_CHECK` opcode.
Fix an issue where several frame objects could be backed by the same interpreter frame, possibly leading to corrupted memory and hard crashes of the interpreter.
Bugfix: :c:func:`PyFunction_GetAnnotations` should return a borrowed reference. It was returning a new reference.
The Garbage Collector now runs only on the eval breaker mechanism of the Python bytecode evaluation loop instead on object allocations. The GC can also run when :c:func:`PyErr_CheckSignals` is called so C extensions that need to run for a long time without executing any Python code also have a chance to execute the GC periodically.
When __package__
is different than __spec__.parent
, raise a
DeprecationWarning
instead of ImportWarning
.
Also remove importlib.util.set_package()
which was scheduled for
removal.
Long deprecated, module_repr()
should now be completely eradicated.
In cases where warnings.warn_explicit()
consults the module's loader, an
DeprecationWarning
is issued when m.__loader__
differs from
m.__spec__.loader
.
Ensure that all Python frame objects are backed by "complete" frames.
Add API for subscribing to modification events on selected dictionaries.
Fix possible data corruption or crashes when accessing the f_back
member
of newly-created generator or coroutine frames.
Fixed a missing incref/decref pair in Exception.__setstate__()
. Patch by
Ofey Chan.
Remove the :func:`sys.getdxp` function and the
Tools/scripts/analyze_dxp.py
script. DXP stands for "dynamic execution
pairs". They were related to DYNAMIC_EXECUTION_PROFILE
and DXPAIRS
macros which have been removed in Python 3.11. Python can now be built with
:option:`./configure --enable-pystats <--enable-pystats>` to gather
statistics on Python opcodes. Patch by Victor Stinner.
Fix the Python path configuration used to initialized :data:`sys.path` at Python startup. Paths are no longer encoded to UTF-8/strict to avoid encoding errors if it contains surrogate characters (bytes paths are decoded with the surrogateescape error handler). Patch by Victor Stinner.
The parser now raises :exc:`SyntaxError` when parsing source code containing null bytes. Patch by Pablo Galindo
Fix a crash occurring when :c:func:`PyEval_GetFrame` is called while the topmost Python frame is in a partially-initialized state.
Fix command line parsing: reject :option:`-X int_max_str_digits <-X>` option with no value (invalid) when the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable is set to a valid limit. Patch by Victor Stinner.
Fix overly-broad source position information for chained comparisons used as branching conditions.
Fix undefined behaviour in audioop.c
.
Fix undefined behaviour in _testcapimodule.c
.
When :exc:`ValueError` is raised if an integer is larger than the limit, mention the :func:`sys.set_int_max_str_digits` function in the error message. Patch by Victor Stinner.
At Python exit, sometimes a thread holding the GIL can wait forever for a thread (usually a daemon thread) which requested to drop the GIL, whereas the thread already exited. To fix the race condition, the thread which requested the GIL drop now resets its request before exiting. Issue discovered and analyzed by Mingliang ZHAO. Patch by Victor Stinner.
Fix a possible assertion failure, fatal error, or :exc:`SystemError` if a line tracing event raises an exception while opcode tracing is enabled.
The PyLong_FromString
function was refactored to make it more
maintainable and extensible.
Fix undefined behaviour in C code of null pointer arithmetic.
Make sure that all frame objects created are created from valid interpreter frames. Prevents the possibility of invalid frames in backtraces and signal handlers.
Improve the performance of reading and writing inline bytecode caches on some platforms.
Remove dead code from CALL_FUNCTION_EX
opcode.
:class:`memoryview` now supports half-floats. Patch by Donghee Na and Antoine Pitrou.
Fix case of undefined behavior in ceval.c
Convert :mod:`!_functools` to argument clinic.
Do not expose KeyWrapper
in :mod:`!_functools`.
Ensure that tracing, sys.setrace()
, is turned on immediately. In
pre-release versions of 3.11, some tracing events might have been lost when
turning on tracing in a __del__
method or interrupt.
Fix use after free in trace refs build mode. Patch by Kumar Aditya.
When loading a file with invalid UTF-8 inside a multi-line string, a correct SyntaxError is emitted.
Make sure that incomplete frames do not show up in tracemalloc traces.
Fix compiler warnings and test failures when building with
--enable-pystats
.
Correctly raise SyntaxError
on exception groups (PEP 654) on python
versions prior to 3.11
Remove two cases of undefined behavior, by adding NULL checks.
Fix possible NULL
pointer dereference in _PyThread_CurrentFrames
.
Patch by Kumar Aditya.
Separate Python recursion checking from C recursion checking which reduces the chance of C stack overflow and allows the recursion limit to be increased safely.
Fix an issue that could prevent :opcode:`LOAD_ATTR` from specializing properly when accessing properties.
Emit a DeprecationWarning when :meth:`~generator.throw`, :meth:`~coroutine.throw` or :meth:`~agen.athrow` are called with more than one argument.
Disable incorrect pickling of the C implemented classmethod descriptors.
Fix text signatures of list.__getitem__
and dict.__getitem__
.
Fix :exc:`AttributeError` missing name
and obj
attributes in
:meth:`object.__getattribute__`. Patch by Philip Georgi.
Change the jump opcodes so that all conditional jumps are forward jumps. Backward jumps are converted by the assembler into a conditional forward jump whose target is the fallthrough block (and with a reversed condition), followed by an unconditional backward jump. For example:
POP_JUMP_IF_TRUE BACKWARD_TARGET
becomes POP_JUMP_IF_FALSE NEXT_BLOCK;
JUMP BACKWARD_TARGET
.
All the directed conditional jump opcodes were removed:
POP_JUMP_FORWARD_IF_TRUE
, POP_JUMP_BACKWARD_IF_TRUE
,
POP_JUMP_FORWARD_IF_FALSE
, POP_JUMP_BACKWARD_IF_FALSE
,
POP_JUMP_FORWARD_IF_NONE
, POP_JUMP_BACKWARD_IF_NONE
,
POP_JUMP_FORWARD_IF_NOT_NONE
, POP_JUMP_BACKWARD_IF_NOT_NONE
.
The corresponding opcodes without direction are no longer pseudo-instructions, and they implement the forward conditional jumps.
Loading a file with invalid UTF-8 will now report the broken character at the correct location.
The internal field _PyInterpreterFrame.f_func
is renamed to
_PyInterpreterFrame.f_funcobj
and may be any object. The f_globals
and f_builtin
fields may hold junk values.
It is safest to treat the _PyInterpreterFrame
struct as opaque.
Fixed a bug that caused _PyCode_GetExtra
to return garbage for negative
indexes. Patch by Pablo Galindo
Add a new -X perf
Python command line option as well as
:func:`sys.activate_stack_trampoline` and
:func:`sys.deactivate_stack_trampoline` function in the :mod:`sys` module
that allows to set/unset the interpreter in a way that the Linux perf
profiler can detect Python calls. The new
:func:`sys.is_stack_trampoline_active` function allows to query the state of
the perf trampoline. Design by Pablo Galindo. Patch by Pablo Galindo and
Christian Heimes with contributions from Gregory P. Smith [Google] and Mark
Shannon.
Fix a deadlock in :c:func:`PyGILState_Ensure` when allocating new thread state. Patch by Kumar Aditya.
:c:func:`PyType_Ready` now initializes ht_cached_keys
and performs
additional checks to ensure that type objects are properly configured. This
avoids crashes in 3rd party packages that don't use regular API to create
new types.
On WASI :const:`~errno.ENOTCAPABLE` is now mapped to :exc:`PermissionError`.
The :mod:`errno` modules exposes the new error number. getpath.py
now
ignores :exc:`PermissionError` when it cannot open landmark files
pybuilddir.txt
and pyenv.cfg
.
Added test a harness for direct unit tests of the compiler's optimization
stage. The _testinternalcapi.optimize_cfg()
function runs the optimiser
on a sequence of instructions. The CfgOptimizationTestCase
class in
test.support
has utilities for invoking the optimizer and checking the
output.
Reduces the size of a "simple" Python object from 8 to 6 words by moving the weakreflist pointer into the pre-header directly before the object's dict/values pointer.
Compile virtual :keyword:`try`/:keyword:`except` blocks to handle exceptions raised during :meth:`~generator.close` or :meth:`~generator.throw` calls through a suspended frame.
Optimized calling :meth:`~object.__get__` with vectorcall. Patch by Kumar Aditya.
Improve error message when a parameter without a default value follows one with a default value, and show the same message, even when the non-default/default sequence is preceded by positional-only parameters.
Fixed bug where the compiler's eliminate_empty_basic_blocks
function
ignores the last block of the code unit.
Skip over incomplete frames in :c:func:`PyThreadState_GetFrame`.
Fix format string in _PyPegen_raise_error_known_location
that can lead
to memory corruption on some 64bit systems. The function was building a
tuple with i
(int) instead of n
(Py_ssize_t) for Py_ssize_t
arguments.
Fix misleading contents of error message when converting an all-whitespace string to :class:`float`.
Update code object hashing and equality to consider all debugging and exception handling tables. This fixes an issue where certain non-identical code objects could be "deduplicated" during compilation.
Reduce allocation size of :class:`list` from :meth:`str.split` and :meth:`str.rsplit`. Patch by Donghee Na and Inada Naoki.
Create a 'jump target label' abstraction in the compiler so that the compiler's codegen stage does not work directly with basic blocks. This prepares the code for changes to the underlying CFG generation mechanism.
_PyPegen_Parser_New
now properly detects token memory allocation errors.
Patch by Honglin Zhu.
Run Python code in tracer/profiler function at full speed. Fixes slowdown in earlier versions of 3.11.
Emit a warning in debug mode if an object does not call :c:func:`PyObject_GC_UnTrack` before deallocation. Patch by Pablo Galindo.
Merge managed dict and values pointer into a single tagged pointer to save one word in the pre-header.
Add cfg_builder struct and refactor the relevant code so that a cfg can be constructed without an instance of the compiler struct.
Prevented crashes in the AST constructor when compiling some absurdly long
expressions like "+0"*1000000
. :exc:`RecursionError` is now raised
instead. Patch by Pablo Galindo
:class:`ast.AST` node positions are now validated when provided to :func:`compile` and other related functions. If invalid positions are detected, a :exc:`ValueError` will be raised.
Fix an issue that caused extended opcode arguments and some conditional pops
to be ignored when calculating valid jump targets for assignments to the
f_lineno
attribute of frame objects. In some cases, this could cause
inconsistent internal state, resulting in a hard crash of the interpreter.
Undocumented PyCode_Addr2Location
function now properly returns when
addrq
argument is less than zero.
Replace all EXTENDED_ARG_QUICK
instructions with basic
:opcode:`EXTENDED_ARG` instructions in unquickened code. Consumers of
non-adaptive bytecode should be able to handle extended arguments the same
way they were handled in CPython 3.10 and older.
Fix incorrect source location info caused by certain optimizations in the bytecode compiler.
Implement :func:`os.setns` and :func:`os.unshare` for Linux. Patch by Noam Cohen.
Fix incorrect source location info for some multi-line attribute accesses and method calls.
Fix error detection in some builtin functions when keyword argument name is
an instance of a str subclass with overloaded __eq__
and __hash__
.
Previously it could cause SystemError or other undesired behavior.
:func:`ast.parse` will no longer parse function definitions with
positional-only params when passed feature_version
less than (3, 8)
.
Patch by Shantanu Jain.
Allow jumping within, out of, and across exception handlers in the debugger.
:func:`ast.parse` will no longer parse parenthesized context managers when
passed feature_version
less than (3, 9)
. Patch by Shantanu Jain.
:func:`ast.parse` will no longer parse assignment expressions when passed
feature_version
less than (3, 8)
. Patch by Shantanu Jain.
Ensures the program name is known for help text during interpreter startup.
Fix the column offsets for some expressions in multi-line f-strings :mod:`ast` nodes. Patch by Pablo Galindo.
Fix an issue where frame object manipulations could corrupt inline bytecode caches.
Fix an issue where lookups of metaclass descriptors may be ignored when an identically-named attribute also exists on the class itself.
Fix an issue where a :class:`bytearray` item assignment could crash if it's resized by the new value's :meth:`__index__` method.
Fix reference counting bug in :meth:`bool.__repr__`. Patch by Kumar Aditya.
Fix an issue that could cause code with multi-line method lookups to have misleading or incorrect column offset information. In some cases (when compiling a hand-built AST) this could have resulted in a hard crash of the interpreter.
Fix an issue that caused internal frames to outlive failed Python function calls, possibly resulting in memory leaks or hard interpreter crashes.
Fix an issue where exceptions raised by line-tracing events would cause frames to be left in an invalid state, possibly resulting in a hard crash of the interpreter.
Disable the compiler's inline-small-exit-blocks optimization for exit blocks that are associated with source code lines. This fixes a bug where the debugger cannot tell where an exception handler ends and the following code block begins.
Line number of a module's RESUME
instruction is set to 0 as specified in
PEP 626.
Account for instructions that can push NULL to the stack when setting line number in a frame. Prevents some (unlikely) crashes.
Reload opcode
when raising unknown opcode error
in the interpreter
main loop, for C compilers to generate dispatching code independently.
Compile and run code with unpacking of extremely large sequences (1000s of elements). Such code failed to compile. It now compiles and runs correctly.
Fixed a tokenizer crash when reading encoded files with syntax errors from
stdin
with non utf-8 encoded text. Patch by Pablo Galindo
Fix an issue when reading line numbers from code objects if the encoded line
numbers are close to INT_MIN
. Patch by Pablo Galindo
Don't create frame objects for incomplete frames. Prevents the creation of generators and closures from being observable to Python and C extensions, restoring the behavior of 3.10 and earlier.
Fix error for dictionary literals with invalid expression as value.
:class:`types.MappingProxyType` instances are now hashable if the underlying mapping is hashable.
Revise the display strategy of traceback enhanced error locations. The indicators are only shown when the location doesn't span the whole line.
Add :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions for more efficient handling and better specialization of slicing operations, where the slice is explicit in the source code.
Fix unreachable code warning in Python/specialize.c
.
Specialize LOAD_ATTR
for objects with custom __getattribute__
.
Improve performance of attribute lookups on objects with custom
__getattribute__
and __getattr__
. Patch by Ken Jin.
Specialize LOAD_ATTR
for property()
attributes.
Refactor compiler optimisation code so that it no longer needs the struct
assembler
and struct compiler
passed around. Instead, each function
takes the CFG and other data that it actually needs. This will make it
possible to test this code directly.
When built with -enable-pystats
, sys._stats_on()
,
sys._stats_off()
, sys._stats_clear()
and sys._stats_dump()
functions have been added to enable gathering stats for parts of programs.
Store offset of first traceable instruction in code object to avoid having to recompute it for each instruction when tracing.
Lazily create a table mapping bytecode offsets to line numbers to speed up calculation of line numbers when tracing.
:class:`types.GenericAlias` no longer relays the __class__
attribute.
For example, isinstance(list[int], type)
no longer returns True
.
Refactor the compiler to reduce boilerplate and repetition.
Fix some exponential backtrace case happening with deeply nested sequence patterns in match statements. Patch by Pablo Galindo
Make sure that the end column offsets are correct in multi-line method calls. Previously, the end column could precede the column offset.
:func:`importlib.invalidate_caches` now drops entries from :data:`sys.path_importer_cache` with a relative path as name. This solves a caching issue when a process changes its current working directory.
FileFinder
no longer inserts a dot in the path, e.g. /egg/./spam
is
now /egg/spam
.
Change order of bytecode instructions emitted for :keyword:`with` and :keyword:`async with` to reduce the number of entries in the exception table.
Reduce the size of the inline cache for LOAD_METHOD
by 2 bytes.
Removed redundant fields from the compiler's basicblock struct:
b_nofallthrough
, b_exit
, b_return
. They can be easily calculated
from the opcode of the last instruction of the block.
LOAD_METHOD
instruction has been removed. It was merged back into
LOAD_ATTR
.
Fixed an assert where an f-string has an equal sign '=' following an expression, but there's no trailing brace. For example, f"{i=".
Cache the result of :c:func:`PyCode_GetCode` function to restore the O(1) lookup of the :attr:`~types.CodeType.co_code` attribute.
Ensure that custom :mod:`ast` nodes without explicit end positions can be compiled. Patch by Pablo Galindo.
Code for exception handlers is emitted at the end of the code unit's bytecode. This avoids one jump when no exception is raised.
Use exponential backoff for specialization counters in the interpreter. Can reduce the number of failed specializations significantly and avoid slowdown for those parts of a program that are not suitable for specialization.
Improve error message for invalid syntax of conversion character in f-string expressions.
Fix a crash in substitution of a TypeVar
in nested generic alias after
TypeVarTuple
.
When a bytecode instruction jumps to an unconditional jump instruction, the first instruction can often be optimized to target the unconditional jump's target directly. For tracing reasons, this would previously only occur if both instructions have the same line number. This also now occurs if the unconditional jump is artificial, i.e., if it has no associated line number.
The --experimental-isolated-subinterpreters
configure option and
EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
macro have been removed.
Fix __lltrace__
debug feature if the stdout encoding is not UTF-8. Patch
by Victor Stinner.
Wraps unused parameters in Objects/obmalloc.c
with Py_UNUSED
.
Avoid NULL
checks for uninitialized local variables by determining at
compile time which variables must be initialized.
Backward jumps after async for
loops are no longer given dubious line
numbers.
Fix contextvars HAMT implementation to handle iteration over deep trees.
The bug was discovered and fixed by Eli Libman. See MagicStack/immutables#84 for more details.
Added the new function :c:func:`PyType_FromMetaclass`, which generalizes the existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass argument. This is useful for language binding tools, where it can be used to intercept type-related operations like subclassing or static attribute access by specifying a metaclass with custom slots.
Importantly, :c:func:`PyType_FromMetaclass` is available in the Limited API, which provides a path towards migrating more binding tools onto the Stable ABI.
Fix the :attr:`__text_signature__` for :meth:`__get__` methods implemented in C. Patch by Jelle Zijlstra.
The operand of the YIELD_VALUE
instruction is set to the stack depth.
This is done to help frame handling on yield
and may assist debuggers.
Fix memory leak in code object's lines and positions iterators as they were not finalized at exit. Patch by Kumar Aditya.
Fixed a crash in _pickle.c
from mutating collections during
__reduce__
or persistent_id
.
The PRECALL instruction has been removed. It offered only a small advantage for specialization and is not needed in the vast majority of cases.
Always round the allocated size for lists up to the nearest even number.
Improve error message for some suites with syntax error before ':'
Decrease default recursion limit on WASI to address limited call stack size.
Fix memory leak in memoryview
iterator as it was not finalized at exit.
Patch by Kumar Aditya.
Specialize LOAD_METHOD
for objects with lazy dictionaries. Patch by Ken
Jin.
Add support for connecting and binding to Hyper-V sockets on Windows Hyper-V hosts and guests.
Remove spurious "LINE" event when starting a generator or coroutine, visible tracing functions implemented in C.
:meth:`!_warnings.warn_explicit` is ported to Argument Clinic.
Make the compiler duplicate an exit block only if none of its instructions have a lineno (previously only the first instruction in the block was checked, leading to unnecessarily duplicated blocks).
The deprecated debug build only PYTHONTHREADDEBUG
environment variable
no longer does anything.
Fix hang when trying to iterate over a typing.Union
.
Specialized the :opcode:`FOR_ITER` opcode using the PEP 659 machinery
Removed duplicate '{0, 0, 0, 0, 0, 0}' entry in 'Objects/unicodetype_db.h'.
Updates the error message for abstract class.
Improve performance of repetition of :class:`list` and :class:`tuple` by
using memcpy
to copy data and performing the reference increments in one
step.
Make --help
output shorter by moving some info to the new --help-env
and --help-xoptions
command-line options. Also add --help-all
option
to print complete usage.
Document some places where an assignment expression needs parentheses.
Fix hang on Windows in subprocess.wait_closed()
in :mod:`asyncio` with
:class:`~asyncio.ProactorEventLoop`. Patch by Kumar Aditya.
:meth:`tkinter.Text.count` raises now an exception for options starting with "-" instead of silently ignoring them.
The :mod:`os` module no longer accepts bytes-like paths, like :class:`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` type is accepted for bytes strings. Patch by Victor Stinner.
Added itertools.batched() to batch data into lists of a given length with the last list possibly being shorter than the others.
Update the bundled copies of pip and setuptools to versions 22.3 and 65.5.0 respectively.
A :meth:`~logging.handlers.SysLogHandler.createSocket` method was added to :class:`~logging.handlers.SysLogHandler`.
Fix bug in :func:`urllib.parse.urlparse` that causes certain port numbers containing whitespace, underscores, plus and minus signs, or non-ASCII digits to be incorrectly accepted.
Make :func:`sys.setprofile` and :func:`sys.settrace` functions reentrant.
They can no long fail with: RuntimeError("Cannot install a trace function
while another trace function is being installed")
. Patch by Victor
Stinner.
Allow :mod:`venv` to pass along :envvar:`!PYTHON*` variables to ensurepip
and pip
when they do not impact path resolution
Deprecated :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` and :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` methods to be removed in Python 3.14. Patch by Kumar Aditya.
On macOS, fix a crash in :func:`syslog.syslog` in multi-threaded
applications. On macOS, the libc syslog()
function is not thread-safe,
so :func:`syslog.syslog` no longer releases the GIL to call it. Patch by
Victor Stinner.
Release the GIL when creating :class:`mmap.mmap` objects on Unix.
Wrap network errors consistently in urllib FTP support, so the test suite doesn't fail when a network is available but the public internet is not reachable.
The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher` and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in Python 3.14. Patch by Kumar Aditya.
Change default child watcher to :class:`~asyncio.PidfdChildWatcher` on Linux systems which supports it. Patch by Kumar Aditya.
Earlier in 3.11 we deprecated asyncio.Task.cancel("message")
. We
realized we were too harsh, and have undeprecated it.
Do not rely solely on __cached__
on modules; code will also support
__spec__.cached
.
Replace deprecated application/javascript
with text/javascript
in
:mod:`mimetypes`. See RFC 9239. Patch by Noam Cohen.
Apply changes from importlib_resources 5.8 and 5.9: Traversable.joinpath
provides a concrete implementation. as_file
now supports directories of
resources.
Remove deprecated :func:`!importlib.util.set_loader` and :func:`!importlib.util.module_for_loader` from :mod:`importlib.util`.
Change deprecate warning message in :mod:`unittest` from
It is deprecated to return a value!=None
to
It is deprecated to return a value that is not None from a test case
Fixes :exc:`AttributeError` when :meth:`subprocess.check_output` is used
with argument input=None
and either of the arguments encoding or
errors are used.
:exc:`NameError` and :exc:`AttributeError` spelling suggestions provided since :gh:`82711` are now also emitted by the pure Python :mod:`traceback` module. Tests for those suggestions now exercise both implementations to ensure they are equivalent. Patch by Carl Friedrich Bolz-Tereick and Łukasz Langa.
:mod:`dataclass` now uses :func:`inspect.get_annotations` to examine the annotations on class objects.
Removed deprecated interfaces in importlib.metadata
(entry points
accessed as dictionary, implicit dictionary construction of sequence of
EntryPoint
objects, mutablility of EntryPoints
result, access of
entry point by index). entry_points
now has a simpler, more
straightforward API (returning EntryPoints
).
Avoid spurious tracebacks from :mod:`asyncio` when default executor cleanup is delayed until after the event loop is closed (e.g. as the result of a keyboard interrupt).
:meth:`gzip.GzipFile.read` reads 10% faster.
Avoid a crash in the C version of :meth:`asyncio.Future.remove_done_callback` when an evil argument is passed.
Remove tokenize.NL
check from :mod:`tabnanny`.
Make Semaphore run faster.
Fix generation of the default name of :class:`tkinter.Checkbutton`. Previously, checkbuttons in different parent widgets could have the same short name and share the same state if arguments "name" and "variable" are not specified. Now they are globally unique.
fix Flag to use boundary CONFORM
This restores previous Flag behavior of allowing flags with non-sequential values to be combined; e.g.
class Skip(Flag): TWO = 2 EIGHT = 8
Skip.TWO | Skip.EIGHT -> <Skip.TWO|EIGHT: 10>
Update bundled libexpat to 2.4.9
Fix race condition in :mod:`asyncio` where :meth:`~asyncio.SubprocessProtocol.process_exited` called before the :meth:`~asyncio.SubprocessProtocol.pipe_data_received` leading to inconsistent output. Patch by Kumar Aditya.
Pass the correct contextvars.Context
when a asyncio
exception
handler is called on behalf of a task or callback handle. This adds a new
Task
method, get_context
, and also a new Handle
method with the
same name. If this method is not found on a task object (perhaps because it
is a third-party library that does not yet provide this method), the context
prevailing at the time the exception handler is called is used.
Fixed check in :mod:`multiprocessing.resource_tracker` that guarantees that
the length of a write to a pipe is not greater than PIPE_BUF
.
Reduce :func:`urllib.parse.quote_from_bytes` memory use on large values.
Contributed by Dennis Sweeney.
Corrected type annotation for dataclass attribute
pstats.FunctionProfile.ncalls
to be str
.
Update :mod:`unicodedata` database to Unicode 15.0.0.
Fix undefined behaviour in :func:`struct.unpack`.
Improve performance of bool(db)
for large ndb/gdb databases. Previously
this would call len(db)
which would iterate over all keys -- the answer
(empty or not) is known after the first key.
Fix the faulthandler implementation of faulthandler.register(signal,
chain=True)
if the sigaction()
function is not available: don't call
the previous signal handler if it's NULL. Patch by Victor Stinner.
Correct conversion of :class:`numbers.Rational`'s to :class:`float`.
Speed up bisect.bisect()
functions by taking advantage of
type-stability.
Fraction hashes are now cached.
In :mod:`typing`, fix missing field name
and incorrect __module__
in
_AnnotatedAlias.
Remove types._cell_factory
from module namespace.
Fix repr
of Any
subclasses.
Work around missing socket functions in :class:`~socket.socket`'s
__repr__
.
Fix TypeVarTuple.__typing_prepare_subst__
. TypeError
was not raised
when using more than one TypeVarTuple
, like [*T, *V]
in type alias
substitutions.
Add match_args
, kw_only
, slots
, and weakref_slot
to
_DataclassParams
.
In :mod:`inspect`, fix overeager replacement of "typing.
" in formatting
annotations.
Added a :meth:`~logging.Logger.getChildren` method to :class:`logging.Logger`, to get the immediate child loggers of a logger.
Use double caching for compiled RE patterns.
Fixed a minor performance regression in :func:`threading.Event.__init__`
Fix :class:`asyncio.streams.StreamReaderProtocol` to keep a strong reference to the created task, so that it's not garbage collected
Fix a bug in unicodedata
: east_asian_width
used to return the wrong
value for unassigned characters; and for yet unassigned, but reserved
characters.
Fix a performance regression in logging TimedRotatingFileHandler. Only check for special files when the rollover time has passed.
Fix unused localName
parameter in the Attr
class in
:mod:`xml.dom.minidom`.
Add AttrDict to JSON module for use with object_hook.
Fix handling compiler warnings (SyntaxWarning and DeprecationWarning) in
:func:`codeop.compile_command` when checking for incomplete input.
Previously it emitted warnings and raised a SyntaxError. Now it always
returns None
for incomplete input without emitting any warnings.
Fix incorrect condition that causes sys.thread_info.name
to be wrong on
pthread platforms.
Fix a bug in the makeunicodedata.py
script leading to about 13 KiB of
space saving in the unicodedata
module, specifically the character
decomposition data.
Remove an incompatible change from :issue:`28080` that caused a regression
that ignored the utf8 in ZipInfo.flag_bits
. Patch by Pablo Galindo.
Add %:z
strftime format code (generates tzoffset with colons as
separator), see :ref:`strftime-strptime-behavior`.
Fix :class:`asyncio.Runner` to call :func:`asyncio.set_event_loop` only once to avoid calling :meth:`~asyncio.AbstractChildWatcher.attach_loop` multiple times on child watchers. Patch by Kumar Aditya.
Fix :class:`unittest.IsolatedAsyncioTestCase` to set event loop before calling setup functions. Patch by Kumar Aditya.
Speed up :func:`urllib.parse.quote_from_bytes` by replacing a list
comprehension with map()
.
Add support for computing Spearman's correlation coefficient to the existing statistics.correlation() function.
Fix logging
shutdown handler so it respects
MemoryHandler.flushOnClose
.
When a task catches :exc:`asyncio.CancelledError` and raises some other error, the other error should generally not silently be suppressed.
The :class:`HTTPStatus <http.HTTPStatus>` enum offers a couple of properties
to indicate the HTTP status category e.g. HTTPStatus.OK.is_success
.
Update bundled pip to 22.2.2.
Fix :class:`asyncio.TaskGroup` to propagate exception when :exc:`asyncio.CancelledError` was replaced with another exception by a context manager. Patch by Kumar Aditya and Guido van Rossum.
Fix incorrect joining of relative Windows paths with drives in :class:`pathlib.PurePath` initializer.
Faster json.dumps()
when sorting of keys is not requested (default).
Improve :meth:`Signature.bind <inspect.Signature.bind>` error message for missing keyword-only arguments.
Update bundled pip to 22.2.1.
Fix GC crash when deallocating _lsprof.Profiler
by untracking it before
calling any callbacks. Patch by Kumar Aditya.
Fail gracefully if :const:`~errno.EPERM` or :const:`~errno.ENOSYS` is raised
when loading :mod:`!crypt` methods. This may happen when trying to load
MD5
on a Linux kernel with :abbr:`FIPS (Federal Information Processing
Standard)` enabled.
Fix :func:`asyncio.run` for :class:`asyncio.Task` implementations without :meth:`~asyncio.Task.uncancel` method. Patch by Kumar Aditya.
Fix IndexError in parsing invalid date in the :mod:`email` module.
Upgrade bundled setuptools to 63.2.0.
Upgrade bundled pip to 22.2.
Fix check for existence of :const:`os.EFD_CLOEXEC`, :const:`os.EFD_NONBLOCK` and :const:`os.EFD_SEMAPHORE` flags on older kernel versions where these flags are not present. Patch by Kumar Aditya.
Fix :meth:`concurrent.futures.Executor.map` to cancel the currently waiting on future on an error - e.g. TimeoutError or KeyboardInterrupt.
Fix a :mod:`sqlite3` regression where *args
and **kwds
were
incorrectly relayed from :py:func:`~sqlite3.connect` to the
:class:`~sqlite3.Connection` factory. The regression was introduced in
3.11a1 with PR 24421 (:gh:`85128`). Patch by Erlend E. Aasland.
Fix :mod:`fileinput` module didn't support errors
option when
inplace
is true.
Fixed flickering of the turtle window when the tracer is turned off. Patch by Shin-myoung-serp.
Add deprecation warning for enum member.member
access (e.g.
Color.RED.BLUE
). Remove EnumMeta.__getattr__
.
Ensure that timeouts scheduled with :class:`asyncio.Timeout` that have already expired are delivered promptly.
:meth:`wsgiref.types.InputStream.__iter__` should return
Iterator[bytes]
, not Iterable[bytes]
. Patch by Shantanu Jain.
Replaced assert with exception in :func:`ast.parse`, when
feature_version
has an invalid major version. Patch by Shantanu Jain.
Add :mod:`sqlite3` :ref:`command-line interface <sqlite3-cli>`. Patch by Erlend Aasland.
Replace :c:expr:`_PyAccu` with :c:expr:`_PyUnicodeWriter` in JSON encoder and StringIO and remove the :c:expr:`_PyAccu` implementation.
Remove -c/--clock
and -t/--time
CLI options of :mod:`timeit`. The
options had been deprecated since Python 3.3 and the functionality was
removed in Python 3.7. Patch by Shantanu Jain.
Fix refleak in _io.TextIOWrapper.reconfigure
. Patch by Kumar Aditya.
Fix binding of unix socket to empty address on Linux to use an available address from the abstract namespace, instead of "0".
Fix crash when deallocating an instance of a subclass of
_multiprocessing.SemLock
. Patch by Kumar Aditya.
Add random.binomialvariate().
Allow :meth:`asyncio.StreamWriter.drain` to be awaited concurrently by multiple tasks. Patch by Kumar Aditya.
When called with capture_locals=True
, the :mod:`traceback` module
functions swallow exceptions raised from calls to repr()
on local
variables of frames. This is in order to prioritize the original exception
over rendering errors. An indication of the failure is printed in place of
the missing value. (Patch by Simon-Martin Schroeder).
Fix :mod:`asyncio` subprocess transport to kill process cleanly when process
is blocked and avoid RuntimeError
when loop is closed. Patch by Kumar
Aditya.
:meth:`SSLContext.set_default_verify_paths` now releases the GIL around
SSL_CTX_set_default_verify_paths
call. The function call performs I/O
and CPU intensive work.
Deprecate aliases :class:`typing.Hashable` and :class:`typing.Sized`
An undocumented python -m pprint
benchmark is moved into pprint
suite of pyperformance. Patch by Oleg Iarygin.
Fix subclassing complex generics with type variables in :mod:`typing`.
Previously an error message saying Some type variables ... are not listed
in Generic[...]
was shown. :mod:`typing` no longer populates
__parameters__
with the __parameters__
of a Python class.
Remove the long-deprecated module_repr()
from :mod:`importlib`.
The ability to access the other values of an enum on an enum (e.g.
Color.RED.BLUE
) has been restored in order to fix a performance
regression.
Fix :func:`asyncio.run` and :class:`unittest.IsolatedAsyncioTestCase` to always the set event loop as it was done in Python 3.10 and earlier. Patch by Kumar Aditya.
Allow setting the attributes of reprlib.Repr
during object
initialization
Port static types of _multiprocessing
module to heap types. Patch by
Kumar Aditya.
Fix crash in :class:`struct.Struct` when it was not completely initialized by initializing it in :meth:`~object.__new__`. Patch by Kumar Aditya.
Re-entrant calls to :func:`sys.setprofile` and :func:`sys.settrace` now raise :exc:`RuntimeError`. Patch by Pablo Galindo.
Fix bug where :meth:`linecache.getline` fails on bad files with :exc:`UnicodeDecodeError` or :exc:`SyntaxError`. It now returns an empty string as per the documentation.
Once a :class:`asyncio.TaskGroup` has started shutting down (i.e., at least one task has failed and the task group has started cancelling the remaining tasks), it should not be possible to add new tasks to the task group.
:mod:`xml.etree`: Remove the ElementTree.Element.copy()
method of the
pure Python implementation, deprecated in Python 3.10, use the
:func:`copy.copy` function instead. The C implementation of :mod:`xml.etree`
has no copy()
method, only a __copy__()
method. Patch by Victor
Stinner.
:mod:`zipimport`: Remove find_loader()
and find_module()
methods,
deprecated in Python 3.10: use the find_spec()
method instead. See
PEP 451 for the rationale. Patch by Victor Stinner.
:func:`shlex.split`: Passing None
for s argument now raises an
exception, rather than reading :data:`sys.stdin`. The feature was deprecated
in Python 3.9. Patch by Victor Stinner.
Strip trailing spaces in :mod:`pydoc` text output.
Fix memory leak in :class:`pickle.Pickler` when looking up :attr:`dispatch_table`. Patch by Kumar Aditya.
Deprecate :mod:`sqlite3` :ref:`default adapters and converters <sqlite3-default-converters>`. Patch by Erlend E. Aasland.
Fixed types of :mod:`struct` module to be immutable. Patch by Kumar Aditya.
Now raise ValueError
when None
or an empty string are passed to
Distribution.from_name
(and other callers).
:func:`shutil.make_archive` now passes the root_dir argument to custom archivers which support it.
The :mod:`dis` module now has the opcodes for pseudo instructions (those which are used by the compiler during code generation but then removed or replaced by real opcodes before the final bytecode is emitted).
Removed undocumented python -m codecs
. Use python -m unittest
test.test_codecs.EncodedFileTest
instead.
Made :class:`!_struct.Struct` GC-tracked in order to fix a reference leak in the :mod:`!_struct` module.
Removed undocumented -t
argument of python -m base64
. Use python
-m unittest test.test_base64.LegacyBase64TestCase.test_encodebytes
instead.
Remove the :func:`locale.format` function, deprecated in Python 3.7: use :func:`locale.format_string` instead. Patch by Victor Stinner.
Remove the :func:`ssl.match_hostname` function. The :func:`ssl.match_hostname` was deprecated in Python 3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer uses the :func:`ssl.match_hostname` function. Patch by Victor Stinner.
Document the context
object used in the venv.EnvBuilder
class, and
add the new environment's library path to it.
Remove the :func:`ssl.wrap_socket` function, deprecated in Python 3.7: instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl.SSLContext.wrap_socket` method. Any package that still uses :func:`ssl.wrap_socket` is broken and insecure. The function neither sends a SNI TLS extension nor validates server hostname. Code is subject to :cwe:`295` Improper Certificate Validation. Patch by Victor Stinner.
Remove the :func:`ssl.RAND_pseudo_bytes` function, deprecated in Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. Patch by Victor Stinner.
:mod:`hashlib`: Remove the pure Python implementation of :func:`hashlib.pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires OpenSSL 1.1.1 (PEP 644): this OpenSSL version provides a C implementation of :func:`~hashlib.pbkdf2_hmac` which is faster. Patch by Victor Stinner.
:mod:`gzip`: Remove the filename
attribute of :class:`gzip.GzipFile`,
deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute
instead. In write mode, the filename
attribute added '.gz'
file
extension if it was not present. Patch by Victor Stinner.
run the :class:`asyncio.PidfdChildWatcher` on the running loop, this allows event loops to run subprocesses when there is no default event loop running on the main thread
Remove io.OpenWrapper
and _pyio.OpenWrapper
, deprecated in Python
3.10: just use :func:`open` instead. The :func:`open` (:func:`io.open`)
function is a built-in function. Since Python 3.10, :func:`!_pyio.open` is
also a static method. Patch by Victor Stinner.
Fix :mod:`pdb` crash after jump caused by a null pointer dereference. Patch by Kumar Aditya.
Manual instantiation of :class:`ssl.SSLSession` objects is no longer allowed as it lead to misconfigured instances that crashed the interpreter when attributes where accessed on them.
:func:`inspect.iscoroutinefunction`, :func:`inspect.isgeneratorfunction`,
and :func:`inspect.isasyncgenfunction` now properly return True
for
duck-typed function-like objects like instances of
:class:`unittest.mock.AsyncMock`.
This makes :func:`inspect.iscoroutinefunction` consistent with the behavior of :func:`asyncio.iscoroutinefunction`. Patch by Mehdi ABAAKOUK.
Fix a regression in the :mod:`sqlite3` where statement objects were not properly cleared and reset after use in cursor iters. The regression was introduced by PR 27884 in Python 3.11a1. Patch by Erlend E. Aasland.
Add keyword argument all_errors
to asyncio.create_connection
so that
multiple connection errors can be raised as an ExceptionGroup
.
Officially deprecate from importlib.abc
classes moved to
importlib.resources.abc
.
Prevent error when activating venv in nested fish instances.
Pickle :class:`enum.Flag` by name.
Fix repr of enum of generic aliases.
Revert the :mod:`re` memory leak when a match is terminated by a signal or memory allocation failure as the implemented fix caused a major performance regression.
Fix double closing of file description in :mod:`tempfile`.
Fixed a regression when :func:`copy.copy`-ing :class:`enum.Flag` with multiple flag members.
Fixed names and __module__
value of :mod:`weakref` classes
:class:`~weakref.ReferenceType`, :class:`~weakref.ProxyType`,
:class:`~weakref.CallableProxyType`. It makes them pickleable.
Fix an issue where :mod:`dis` utilities could report missing or incorrect
position information in the presence of CACHE
entries.
Set __future__.annotations
to have a None
mandatoryRelease to
indicate that it is currently 'TBD'.
Emscripten and WASI have no home directory and cannot provide PEP 370 user site directory.
:func:`copy.copy` and :func:`copy.deepcopy` now always raise a TypeError if
__reduce__()
returns a tuple with length 6 instead of silently ignore
the 6th item or produce incorrect result.
Fix a multiprocessing bug where a global named resource (such as a semaphore) could leak when a child process is spawned (as opposed to forked).
Fixed a case where dataclasses would try to add __weakref__
into the
__slots__
for a dataclass that specified weakref_slot=True
when it
was already defined in one of its bases. This resulted in a TypeError
upon the new class being created.
:mod:`sqlite3` now correctly detects DML queries with leading comments. Patch by Erlend E. Aasland.
Update :data:`sqlite3.Cursor.rowcount` when a DML statement has run to
completion. This fixes the row count for SQL queries like UPDATE ...
RETURNING
. Patch by Erlend E. Aasland.
Expose FICLONE
and FICLONERANGE
constants in :mod:`fcntl`. Patch by
Illia Volochii.
Deprecate :data:`!version` and :data:`!version_info`.
Suppress writing an XML declaration in open files in ElementTree.write()
with encoding='unicode'
and xml_declaration=None
.
Support splitting of unpacked arbitrary-length tuple over TypeVar
and
TypeVarTuple
parameters. For example:
A[T, *Ts][*tuple[int, ...]]
->A[int, *tuple[int, ...]]
A[*Ts, T][*tuple[int, ...]]
->A[*tuple[int, ...], int]
Fix the :func:`importlib.resources.as_file` context manager to remove the temporary file if destroyed late during Python finalization: keep a local reference to the :func:`os.remove` function. Patch by Victor Stinner.
Make :class:`multiprocessing.Pool` raise an exception if
maxtasksperchild
is not None
or a positive int.
Add :const:`os.PIDFD_NONBLOCK` flag to open a file descriptor for a process with :func:`os.pidfd_open` in non-blocking mode. Patch by Kumar Aditya.
Implement Enum.__contains__
that returns True
or False
to replace the
deprecated behaviour that would sometimes raise a :exc:`TypeError`.
Make asyncio task groups prevent child tasks from being GCed
Changed :class:`argparse.ArgumentParser` to use :term:`filesystem encoding
and error handler` instead of default text encoding to read arguments from
file (e.g. fromfile_prefix_chars
option). This change affects Windows;
argument file should be encoded with UTF-8 instead of ANSI Codepage.
Accessing the :attr:`pathlib.PurePath.parents` sequence of an absolute path using negative index values produced incorrect results.
Add the ability for :func:`logging.config.dictConfig` to usefully configure :class:`~logging.handlers.QueueHandler` and :class:`~logging.handlers.QueueListener` as a pair, and add :func:`logging.getHandlerByName` and :func:`logging.getHandlerNames` APIs to allow access to handlers by name.
The :mod:`!smtpd` module was removed per the schedule in PEP 594.
Replace assert
statements with raise AssertionError()
in
:class:`~wsgiref.BaseHandler` so that the tested behaviour is maintained
running with optimizations (-O)
.
Fix broken :class:`asyncio.Semaphore` when acquire is cancelled.
The :func:`locale.resetlocale` function is deprecated and will be removed in
Python 3.13. Use locale.setlocale(locale.LC_ALL, "")
instead. Patch by
Victor Stinner.
Added taskName
attribute to :mod:`logging` module for use with
:mod:`asyncio` tasks.
:func:`shutil.make_archive` no longer temporarily changes the current
working directory during creation of standard .zip
or tar archives.
The :func:`re.template` function and the corresponding :const:`re.TEMPLATE` and :const:`re.T` flags are restored after they were removed in 3.11.0b1, but they are now deprecated, so they might be removed from Python 3.13.
Search in some strings (platform dependent i.e [U+0xFFFF, U+0x0100] on Windows or [U+0xFFFFFFFF, U+0x00010000] on Linux 64-bit) are now up to 10 times faster.
Fix :exc:`re.error` raised in :mod:`fnmatch` if the pattern contains a
character range with upper bound lower than lower bound (e.g. [c-a]
).
Now such ranges are interpreted as empty ranges.
No longer convert the database argument of :func:`sqlite3.connect` to bytes before passing it to the factory.
In a very special case, the email package tried to append the nonexistent
InvalidHeaderError
to the defect list. It should have been
InvalidHeaderDefect
.
Fix :func:`ast.unparse` when ImportFrom.level
is None
Now :func:`~dis.dis` and :func:`~dis.get_instructions` handle operand values
for instructions prefixed by EXTENDED_ARG_QUICK
. Patch by Sam Gross and
Donghee Na.
Fix :func:`venv.ensure_directories` to accept :class:`pathlib.Path` arguments in addition to :class:`str` paths. Patch by David Foster.
Removed the encoding
argument from :func:`os.popen` that was added in
3.11b1.
Fix function :func:`sqlite.connect` and the :class:`sqlite.Connection` constructor on non-UTF-8 locales. Also, they now support bytes paths non-decodable with the current FS encoding.
Added :class:`~ctypes.c_time_t` to :mod:`ctypes`, which has the same size as the :c:type:`time_t` type in C.
Fixed crash resulting from calling bisect.insort() or bisect.insort_left()
with the key argument not equal to None
.
:mod:`subprocess` now fails early on Emscripten and WASI platforms to work around missing :func:`os.pipe` on WASI.
Removed many old deprecated :mod:`unittest` features:
:class:`~unittest.TestCase` method aliases, undocumented and broken
:class:`~unittest.TestCase` method assertDictContainsSubset
,
undocumented :meth:`TestLoader.loadTestsFromModule
<unittest.TestLoader.loadTestsFromModule>` parameter use_load_tests, and
an underscored alias of the :class:`~unittest.TextTestResult` class.
Allow multi-element reprs emitted by :mod:`reprlib` to be pretty-printed using configurable indentation.
Fixed :func:`ast.unparse` for empty tuples in the assignment target context.
:meth:`~datetime.datetime.utcfromtimestamp` no longer attempts to resolve
fold
in the pure Python implementation, since the fold is never 1 in
UTC. In addition to being slightly faster in the common case, this also
prevents some errors when the timestamp is close to :attr:`datetime.min
<datetime.datetime.min>`. Patch by Paul Ganssle.
Removed randrange() functionality deprecated since Python 3.10. Formerly, randrange(10.0) losslessly converted to randrange(10). Now, it raises a TypeError. Also, the exception raised for non-integral values such as randrange(10.5) or randrange('10') has been changed from ValueError to TypeError.
Add :meth:`pathlib.Path.walk` as an alternative to :func:`os.walk`.
Fix :meth:`pathlib.Path.rglob` for empty pattern.
Allow :mod:`logging` filters to return a :class:`logging.LogRecord` instance so that filters attached to :class:`logging.Handler`s can enrich records without side effects on other handlers.
Fix a bug in :mod:`argparse` where nargs="*"
would raise an error
instead of returning an empty list when 0 arguments were supplied if choice
was also defined in parser.add_argument
.
Remove undocumented :mod:`sqlite3` features deprecated in Python 3.10:
sqlite3.enable_shared_cache()
sqlite3.OptimizedUnicode
Patch by Erlend E. Aasland.
Fix an issue that occurred after interrupting :func:`threading.Condition.notify`.
The statistics.median_grouped() function now always return a float. Formerly, it did not convert the input type when for sequences of length one.
The :class:`pathlib.Path` deprecated method link_to
has been removed.
Use 3.10's :meth:`~pathlib.Path.hardlink_to` method instead as its semantics
are consistent with that of :meth:`~pathlib.Path.symlink_to`.
Removed :mod:`configparser` module APIs: the SafeConfigParser
class
alias, the ParsingError.filename
property and parameter, and the
ConfigParser.readfp
method, all of which were deprecated since Python
3.2.
Add :meth:`~object.__class_getitem__` to :class:`csv.DictReader` and :class:`csv.DictWriter`, allowing them to be parameterized at runtime. Patch by Marc Mueller.
Add SO_RTABLE
and SO_USER_COOKIE
constants to :mod:`socket`.
:class:`~xml.etree.ElementTree.ElementTree` method
:meth:`~xml.etree.ElementTree.ElementTree.write` and function
:func:`~xml.etree.ElementTree.tostring` now use the text file's encoding
("UTF-8" if not available) instead of locale encoding in XML declaration
when encoding="unicode"
is specified.
:func:`os.path.splitdrive` now understands DOS device paths with UNC links
(beginning \\?\UNC\
). Contributed by Barney Gale.
Apply more strict rules for numerical group references and group names in regular expressions. Only sequence of ASCII digits is now accepted as a numerical reference. The group name in bytes patterns and replacement strings can now only contain ASCII letters and digits and underscore.
Worker processes for :class:`concurrent.futures.ProcessPoolExecutor` are no
longer spawned on demand (a feature added in 3.9) when the multiprocessing
context start method is "fork"
as that can lead to deadlocks in the
child processes due to a fork happening while threads are running.
Move imports in :class:`~multiprocessing.SharedMemory` methods to module level so that they can be executed late in python finalization.
Remove an unhandled error case in the C implementation of calls to :meth:`datetime.fromtimestamp <datetime.datetime.fromtimestamp>` with no time zone (i.e. getting a local time from an epoch timestamp). This should have no user-facing effect other than giving a possibly more accurate error message when called with timestamps that fall on 10000-01-01 in the local time. Patch by Paul Ganssle.
Improve performance of urllib.request.getproxies_environment
when there
are many environment variables
Speed up the regular expression substitution (functions :func:`re.sub` and :func:`re.subn` and corresponding :class:`re.Pattern` methods) for replacement strings containing group references by 2--3 times.
Fix findtext in the xml module to only give an empty string when the text
attribute is set to None
.
Deprecate current default auto() behavior: In 3.13 the default will be for for auto() to always return the largest member value incremented by 1, and to raise if incompatible value types are used.
Fixed an issue with inconsistent trailing slashes in tarfile longname directories.
:class:`zipfile.ZipFile` now raises :exc:`zipfile.BadZipFile` instead of
ValueError
when reading a corrupt zip file in which the central
directory offset is negative.
Fix handling of the doc
argument in subclasses of :func:`property`.
:mod:`ctypes` dependency libffi
is now detected with pkg-config
.
The constructors for :class:`~csv.DictWriter` and :class:`~csv.DictReader`
now coerce the fieldnames
argument to a :class:`list` if it is an
iterator.
Fix :func:`dataclasses.asdict` crash when :class:`collections.defaultdict` is present in the attributes.
Add an index_pages parameter to support using non-default index page names.
Drop support for :class:`bytes` on :data:`sys.path`.
Order the contents of zipapp archives, to make builds more reproducible.
Implement :meth:`pathlib.Path.is_mount` for Windows paths.
In :class:`QueueHandler`, clear stack_info
from :class:`LogRecord` to
prevent stack trace from being written twice.
Fix the formatting for await x
and not x
in the operator precedence
table when using the :func:`help` system.
Improve error message when trying to subclass an instance of :data:`typing.TypeVar`, :data:`typing.ParamSpec`, :data:`typing.TypeVarTuple`, etc. Based on patch by Gregory Beauregard.
Restrict use of sockets instead of pipes for stdin of subprocesses created by :mod:`asyncio` to AIX platform only.
Set :attr:`doctest.DocTest.lineno` to None
when object does not have
:attr:`__doc__`.
Fix :mod:`ensurepip` environment isolation for subprocess running pip
.
Fix :mod:`asyncio` incorrect traceback when future's exception is raised multiple times. Patch by Kumar Aditya.
Add support of context managers in :mod:`unittest`: methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest.TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of class :class:`~unittest.IsolatedAsyncioTestCase` and function :func:`unittest.enterModuleContext`.
Enable fast seeking of uncompressed unencrypted :class:`zipfile.ZipExtFile`
Fix incorrect parsing of Windows registry proxy settings
Add :func:`threading.get_native_id` support for DragonFly BSD. Patch by David Carlier.
The :class:`tempfile.NamedTemporaryFile` function has a new optional parameter delete_on_close
Give the same callback function for when the overlapped operation is done to
the functions recv
, recv_into
, recvfrom
, sendto
, send
and sendfile
inside IocpProactor
.
Fixed :meth:`collections.UserDict.get` to not call :meth:`__missing__` when a value is not found. This matches the behavior of :class:`dict`. Patch by Bar Harel.
:mod:`importlib` now uses f-strings internally instead of str.format
.
Add timeout parameter to :meth:`asyncio.loop.shutdown_default_executor`.
The default value is None
, which means the executor will be given an
unlimited amount of time. When called from :class:`asyncio.Runner` or
:func:`asyncio.run`, the default timeout is 5 minutes.
:meth:`sqlite3.Connection.iterdump` now handles databases that use
AUTOINCREMENT
in one or more tables.
Support reading wave files with the WAVE_FORMAT_EXTENSIBLE
format in the
:mod:`wave` module.
Allow adjustable compression level for tarfile streams in :func:`tarfile.open`.
Remove extra row
Deprecated tools make suspicious
and rstlint.py
are now removed.
They have been replaced by :pypi:`sphinx-lint`.
Fix !
in c domain ref target syntax via a conf.py
patch, so it works
as intended to disable ref target resolution.
Fraction literals now support whitespace around the forward slash,
Fraction('2 / 3')
.
Improve discoverability of the higher level concurrent.futures module by providing clearer links from the lower level threading and multiprocessing modules.
What's New 3.11 now has instructions for how to provide compiler and linker flags for Tcl/Tk and OpenSSL on RHEL 7 and CentOS 7.
Clarified the conflicting advice given in the :mod:`ast` documentation about
:func:`ast.literal_eval` being "safe" for use on untrusted input while at
the same time warning that it can crash the process. The latter statement is
true and is deemed unfixable without a large amount of work unsuitable for a
bugfix. So we keep the warning and no longer claim that literal_eval
is
safe.
Fix stylesheet not working in Windows CHM htmlhelp docs and add warning that they are deprecated. Contributed by C.A.M. Gerlach.
Replaced incorrectly written true/false values in documentation. Patch by Robert O'Shea
Update library documentation with :ref:`availability information
<wasm-availability>` on WebAssembly platforms wasm32-emscripten
and
wasm32-wasi
.
Use consistent syntax for platform availability. The directive now supports a content body and emits a warning when it encounters an unknown platform.
Document the PEP 246 style protocol type :class:`sqlite3.PrepareProtocol`.
Document a limitation in ThreadPoolExecutor where its exit handler is executed before any handlers in atexit.
Clarify :mod:`sqlite3` behavior when :ref:`sqlite3-connection-context-manager`.
Align :mod:`sqlite3` argument specs with the actual implementation.
The minimum Sphinx version required to build the documentation is now 3.2.
Augmented documentation of asyncio.create_task(). Clarified the need to keep strong references to tasks and added a code snippet detailing how to do this.
Clarify that :option:`-W` and :envvar:`PYTHONWARNINGS` are matched literally and case-insensitively, rather than as regular expressions, in :mod:`warnings`.
Update tutorial introduction output to use 3.10+ SyntaxError invalid range.
Added release dates for "What's New in Python 3.X" for 3.0, 3.1, 3.2, 3.8 and 3.10
Document that :class:`pathlib.PurePath` does not collapse initial double slashes because they denote UNC paths.
Document that :func:`inspect.getdoc`, :func:`inspect.getmodule`, and
:func:`inspect.getsourcefile` might return None
.
The Differ
documentation now also mentions other whitespace characters,
which make it harder to understand the diff output.
Overhaul the :ref:`error-handlers` documentation in :mod:`codecs`.
Document tkinter.Tk args.
On Windows, when the Python test suite is run with the -jN
option, the
ANSI code page is now used as the encoding for the stdout temporary file,
rather than using UTF-8 which can lead to decoding errors. Patch by Victor
Stinner.
Fixed the failure of repeated runs of test.test_unittest
caused by side
effects in test_dotted_but_module_not_loaded
.
Mitigate the inherent race condition from using find_unused_port() in testSockName() by trying to find an unused port a few times before failing. Patch by Ross Burton.
:source:`Lib/test/test_asyncio/test_ssl.py` exposed a bug in the macOS kernel where intense concurrent load on non-blocking sockets occasionally causes :const:`errno.ENOBUFS` ("No buffer space available") to be emitted. FB11063974 filed with Apple, in the mean time as a workaround buffer size used in tests on macOS is decreased to avoid intermittent failures. Patch by Fantix King.
Fix problem with test_ssl
test_get_ciphers
on systems that require
perfect forward secrecy (PFS) ciphers.
Make multiprocessing test case test_shared_memory_recreate
parallel-safe.
Move tests for importlib.resources into test_importlib.resources.
Updated tests to use preferred location for importlib.resources
ABCs.
Add a regression test for :mod:`re` exponentional slowdown when using rjsmin.
Added more tests for :mod:`dataclasses` to cover behavior with data descriptor-based fields.
test_ssl
is now checking for supported TLS version and protocols in more
tests.
Tests now check for DAC override capability instead of relying on :func:`os.geteuid`.
Rename test_tk to test_tkinter, and rename test_ttk_guionly to test_ttk. Patch by Victor Stinner.
Move Lib/ctypes/test/
to Lib/test/test_ctypes/
. Patch by Victor
Stinner.
In test_bdb.StateTestCase.test_skip, avoid including auxiliary importers.
Provide nicer error reporting from subprocesses in test_venv.EnsurePipTest.test_with_pip.
Add test cases for :c:func:`PyNumber_ToBase` that take a large number or a non-int object as parameter.
test_asyncio, test_logging, test_socket and test_socketserver now create
AF_UNIX domains in the current directory to no longer fail with
OSError("AF_UNIX path too long")
if the temporary directory (the
:envvar:`TMPDIR` environment variable) is too long. Patch by Victor Stinner.
regrtest now checks if a test leaks temporary files or directories if run with -jN option. Patch by Victor Stinner.
run_tests.py
now handles cross compiling env vars correctly and pass
HOSTRUNNER
to regression tests.
test_modulefinder
now creates a temporary directory in
ModuleFinderTest.setUp()
instead of module scope.
Fix issue with test_unicode test_raiseMemError. The test case now use
test.support.calcobjsize
to calculate size of PyUnicode structs.
:func:`sys.getsizeof` may return different size when string has UTF-8
memory.
WASI does not have a chmod(2)
syscall. :func:`os.chmod` is now a dummy
function on WASI. Skip all tests that depend on working :func:`os.chmod`.
Skip tests on WASI that require symlinks with absolute paths.
Increase calendar test coverage for :meth:`calendar.LocaleTextCalendar.formatweekday`.
Skip symlink tests on WASI. wasmtime uses openat2(2)
with
RESOLVE_BENEATH
flag, which prevents symlinks with absolute paths.
Fix test_embed
for out-of-tree builds. Patch by Kumar Aditya.
Fixing tests that fail when running with optimizations (-O
) in
test_imaplib.py
.
Fixing tests that fail when running with optimizations (-O
) in
test_zipimport.py
Fixing tests that fail when running with optimizations (-O
) in
test_py_compile.py
Fixing tests that fail when running with optimizations (-O
) in
test_sys_settrace.py
.
Fixing tests that fail when running with optimizations (-O
) in
_test_multiprocessing.py
Skip test_shutil.TestCopy.test_copyfile_nonexistent_dir
test on AIX as
the test uses a trailing slash to force the OS consider the path as a
directory, but on AIX the trailing slash has no effect and is considered as
a file.
Remove unused test.support.BasicTestRunner
. Patch by Jelle Zijlstra.
Create a GitHub Actions workflow for verifying bundled pip and setuptools. Patch by Illia Volochii and Adam Turner.
Fix the build process of clang compiler for :program:`_bootstrap_python` if LTO optimization is applied. Patch by Matthias Görgens and Donghee Na.
wasm32-emscripten
builds for browsers now include
:mod:`concurrent.futures` for :mod:`asyncio` and :mod:`unittest.mock`.
CPython now uses the ThinLTO option as the default policy if the Clang compiler accepts the flag. Patch by Donghee Na.
Ensure that Windows releases built with Tools\msi\buildrelease.bat
are
upgradable to and from official Python releases.
Shared module targets now depend on new MODULE_DEPS
variable, which
includes EXPORTSYMS
. This fixes a build order issue on unsupported AIX
platform.
wasm32-emscripten
platform no longer builds :mod:`resource` module,
:func:`~os.getresuid`, :func:`~os.getresgid`, and their setters. The APIs
are stubs and not functional.
Add a new --with-dsymutil
configure option to link debug information
in macOS. Patch by Pablo Galindo.
Use the BOLT post-link optimizer to improve performance, particularly on medium-to-large applications.
Remove the configure --with-cxx-main
build option: it didn't work for
many years. Remove the MAINCC
variable from configure
and
Makefile
. Patch by Victor Stinner.
Fix a regression in configure
script that caused some header checks to
ignore custom CPPFLAGS
. The regression was introduced in :gh:`94802`.
wasm32-wasi builds no longer depend on WASIX's pthread stubs. Python now has its own stubbed pthread API.
Python now detects missing dup
function in WASI and works around some
missing :mod:`errno`, :mod:`select`, and :mod:`socket` constants.
Python now skips missing :mod:`socket` functions and methods on WASI. WASI can only create sockets from existing fd / accept and has no netdb.
Platforms wasm32-unknown-emscripten
and wasm32-unknown-wasi
have
been promoted to PEP 11 tier 3 platform support.
Fixed _decimal
module build issue on GCC when compiling with LTO and
pydebug. Debug builds no longer force inlining of functions.
Fix the possible performance regression of :c:func:`PyObject_Free` compiled with MSVC version 1932.
configure
now uses custom flags like ZLIB_CFLAGS
and ZLIB_LIBS
when searching for headers and libraries.
deepfreeze.py
now supports code object with frozensets that contain
incompatible, unsortable types.
Build and test with OpenSSL 1.1.1q
Dependencies of :mod:`readline` and :mod:`curses` module are now detected in
configure
script with pkg-config
. Only ncurses
/ ncursesw
are detected automatically. The old curses
library is not configured
automatically. Workaround for missing termcap
or tinfo
library has
been removed.
Fix building _ctypes
extension without pkg-config
.
_dbm
module dependencies are now detected by configure.
makesetup
now works around an issue with sed on macOS and uses correct
CFLAGS for object files that end up in a shared extension. Module CFLAGS are
used before PY_STDMODULE_CFLAGS to avoid clashes with system headers.
C extension modules are now built by configure
and make
instead of
distutils
and setup.py
.
The 2to3
, idle
, and pydoc
scripts are now generated and
installed by Makefile
instead of setup.py
.
Updated pegen regeneration script on Windows to find and use Python 3.9 or higher. Prior to this, pegen regeneration already required 3.9 or higher, but the script may have used lower versions of Python.
Address race condition in Makefile
when installing a PGO build. All
test
and install
targets now depend on all
target.
configure
now detects and reports PEP 11 support tiers.
Fix Modules/Setup.stdlib.in
rule for _sqlite3
extension.
va_start()
with two parameters, like va_start(args, format),
is now
required to build Python. va_start()
is no longer called with a single
parameter. Patch by Kumar Aditya.
Python now always use the %zu
and %zd
printf formats to format a
:c:type:`size_t` or Py_ssize_t
number. Building Python 3.12 requires a C11
compiler, so these printf formats are now always supported. Patch by Victor
Stinner.
Disable pymalloc and increase stack size on wasm32-wasi
.
Drop invalid compiler switch -fPIC
for HP aCC on HP-UX. Patch by Michael
Osipov.
Fixes :mod:`multiprocessing` spawning child processes on Windows from a virtual environment to ensure that child processes that also use :mod:`multiprocessing` to spawn more children will recognize that they are in a virtual environment.
Fix :file:`py.exe` launcher handling of :samp:`-V:{<company>}/` option when default preferences have been set in environment variables or configuration files.
Fix possible crashes caused by the use of uninitialized variables when pass
invalid arguments in :func:`os.system` on Windows and in Windows-specific
modules (like winreg
).
Made :ref:`launcher` install per-user by default (unless an all users install already exists), and clarify some text in the installer.
The Tools
directory is no longer installed on Windows
Update libffi to 3.4.3
Fixes a potential buffer overrun in :mod:`!msilib`.
Fixes the Windows launcher not using the compatible interpretation of default tags found in configuration files when no tag was passed to the command.
Fix :file:`pcbuild.proj` to clean previous instances of output files in
Python\deepfreeze
and Python\frozen_modules
directories on Windows.
Patch by Charlie Zhao.
Updates :mod:`platform` code getting the Windows version to use native Windows Management Instrumentation (WMI) queries to determine OS version, type, and architecture.
Make certain requirements of the Windows Store package optional to allow installing on earlier updates of Windows.
Enable the :meth:`~sqlite3.Connection.enable_load_extension` :mod:`sqlite3` API.
Fixes some issues where the Windows installer would incorrectly detect certain features of an existing install when upgrading.
Restores the behaviour of :ref:`launcher` for /usr/bin/env
shebang
lines, which will now search :envvar:`PATH` for an executable matching the
given command. If none is found, the usual search process is used.
Fixes the unsuccessful removal of the HTML document directory when uninstalling with Windows msi.
Fix :ref:`launcher` handling of :file:`py.ini` commands (it was incorrectly
expecting a py_
prefix on keys) and crashes when reading per-user
configuration file.
Fix :ref:`launcher` handling of command lines where it is only passed a short executable name.
Allow virtual environments to correctly launch when they have spaces in the path.
Fix incorrect handling of shebang lines in py.exe launcher
:mod:`zipfile` will now remove trailing spaces from path components when extracting files on Windows.
Drag and drop of files onto Python files in Windows Explorer has been enabled for Windows ARM64.
:func:`os.get_terminal_size` now attempts to read the size from any provided handle, rather than only supporting file descriptors 0, 1 and 2.
Ensures that :file:`py.exe` will prefer an active virtual environment over default tags specified with environment variables or through a :file:`py.ini` file.
Explicitly disable incremental linking for non-Debug builds
:mod:`asyncio` no longer throws RuntimeError: Event loop is closed
on
interpreter exit after asynchronous socket activity. Patch by Oleg Iarygin.
Update Windows installer to use SQLite 3.38.4.
Accept os.PathLike for the argument to winsound.PlaySound
Support native Windows case-insensitive path comparisons by using
LCMapStringEx
instead of :func:`str.lower` in :func:`ntpath.normcase`.
Add LCMapStringEx
to the :mod:`!_winapi` module.
Prevent installation on unsupported Windows versions.
The macOS 13 SDK includes support for the mkfifoat
and mknodat
system calls. Using the dir_fd
option with either :func:`os.mkfifo` or
:func:`os.mknod` could result in a segfault if cpython is built with the
macOS 13 SDK but run on an earlier version of macOS. Prevent this by adding
runtime support for detection of these system calls ("weaklinking") as is
done for other newer syscalls on macOS.
Fix a bug in the previous bugfix that caused IDLE to not start when run with 3.10.8, 3.12.0a1, and at least Microsoft Python 3.10.2288.0 installed without the Lib/test package. 3.11.0 was never affected.
Document handling of extensions in Save As dialogs.
Include prompts when saving Shell (interactive input and output).
Fix the Shell context menu copy-with-prompts bug of copying an extra line when one selects whole lines.
In the Edit menu, move Select All
and add a new separator.
Enable using IDLE's module browser with .pyw files.
Add .pyi as a recognized extension for IDLE on macOS. This allows opening stub files by double clicking on them in the Finder.
Remove ptags and eptags scripts.
Remove the Tools/demo/
directory which contained old demo scripts. A
copy can be found in the old-demos project. Patch by Victor Stinner.
Remove outdated example scripts of the Tools/scripts/
directory. A copy
can be found in the old-demos project. Patch by Victor Stinner.
The wasm_build.py
script now pre-builds Emscripten ports, checks for
broken EMSDK versions, and warns about pkg-config env vars.
The new tool Tools/wasm/wasm_builder.py
automates configure, compile,
and test steps for building CPython on WebAssembly platforms.
Fix handling of module docstrings in :file:`Tools/i18n/pygettext.py`.
Add script Tools/scripts/check_modules.py
to check and validate builtin
and shared extension modules. The script also handles Modules/Setup
and
will eventually replace setup.py
.
Fix Argument Clinic output to custom file destinations. Patch by Erlend E. Aasland.
Allow parameters named module
and self
with custom C names in
Argument Clinic. Patch by Erlend E. Aasland
The Tools/scripts/parseentities.py
script used to parse HTML4 entities
has been removed.
The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like paths, like :class:`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` type is accepted for bytes strings. Patch by Victor Stinner.
Add :c:func:`PyType_Watch` and related APIs to allow callbacks on :c:func:`PyType_Modified`.
Lazily create and cache co_
attributes for better performance for code
getters.
Configuration for the :ref:`integer string conversion length limitation <int_max_str_digits>` now lives in the PyConfig C API struct.
Extensions classes that set tp_dictoffset
and tp_weaklistoffset
lose
the support for multiple inheritance, but are now safe. Extension classes
should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and
:c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead.
An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous versions it caused all the rest of the format string to be copied as-is to the result string, and any extra arguments discarded.
Restore the 3.10 behavior for multiple inheritance of C extension classes that store their dictionary at the end of the struct.
Support C extensions using managed dictionaries by setting the
Py_TPFLAGS_MANAGED_DICT
flag.
API for implementing vectorcall (:c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`, :c:func:`PyVectorcall_NARGS` and :c:func:`PyVectorcall_Call`) was added to the limited API and stable ABI.
Fix sign placement when specifying width or precision in :c:func:`PyUnicode_FromFormat` and :c:func:`PyUnicode_FromFormatV`. Patch by Philip Georgi.
The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class when the class's :py:meth:`~object.__call__` method is reassigned. This makes vectorcall safe to use with mutable types (i.e. heap types without the :const:`immutable <Py_TPFLAGS_IMMUTABLETYPE>` flag). Mutable types that do not override :c:member:`~PyTypeObject.tp_call` now inherit the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag.
Creating :c:macro:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable bases is deprecated and is planned to be disabled in Python 3.14.
Adds unstable C-API functions _PyObject_VisitManagedDict
and
_PyObject_ClearManagedDict
to allow C extensions to allow the VM to
manage their object's dictionaries.
Added :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` and
:c:func:`PyCode_GetFreevars` for accessing co_varnames
, co_cellvars
and co_freevars
respectively via the C API.
Fix SystemError
raised when :c:func:`PyArg_ParseTupleAndKeywords` is
used with #
in (...)
but without PY_SSIZE_T_CLEAN
defined.
Python again uses C-style casts for most casting operations when compiled
with C++. This may trigger compiler warnings, if they are enabled with e.g.
-Wold-style-cast
or -Wzero-as-null-pointer-constant
options for
g++
.
The following frame functions and type are now directly available with
#include <Python.h>
, it's no longer needed to add #include
<frameobject.h>
:
- :c:func:`PyFrame_Check`
- :c:func:`PyFrame_GetBack`
- :c:func:`PyFrame_GetBuiltins`
- :c:func:`PyFrame_GetGenerator`
- :c:func:`PyFrame_GetGlobals`
- :c:func:`PyFrame_GetLasti`
- :c:func:`PyFrame_GetLocals`
- :c:type:`PyFrame_Type`
Patch by Victor Stinner.
Fix the compatibility of the Python C API with C++ older than C++11. Patch by Victor Stinner.
Avoid defining the static_assert
when compiling with C++ 11, where this
is a keyword and redefining it can lead to undefined behavior. Patch by
Pablo Galindo
:c:func:`PyType_FromMetaclass` (and other PyType_From*
functions) now
check that offsets and the base class's
:c:member:`~PyTypeObject.tp_basicsize` fit in the new class's
tp_basicsize
.
Add two new public functions to the public C-API, :c:func:`PyEval_SetProfileAllThreads` and :c:func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling functions in all running threads in addition to the calling one. Also, two analogous functions to the :mod:`threading` module (:func:`threading.setprofile_all_threads` and :func:`threading.settrace_all_threads`) that allow to do the same from Python. Patch by Pablo Galindo
Add C++ overloads for _Py_CAST_impl() to handle 0/NULL. This will allow C++ extensions that pass 0 or NULL to macros using _Py_CAST() to continue to compile.
Slot IDs in PyType_Spec may not be repeated. The documentation was updated to mention this. For some cases of repeated slots, PyType_FromSpec and related functions will now raise an exception.
Fix C++ compiler warnings when casting function arguments to PyObject*
.
Patch by Serge Guelton.
Deprecate global configuration variables, like :c:var:`Py_IgnoreEnvironmentFlag`, in the documentation: the :c:func:`Py_InitializeFromConfig` API should be instead. Patch by Victor Stinner.
Deprecate global configuration variable like :c:var:`Py_IgnoreEnvironmentFlag`: the :c:func:`Py_InitializeFromConfig` API should be instead. Patch by Victor Stinner.
Ensures changes to :c:member:`PyConfig.module_search_paths` are ignored unless :c:member:`PyConfig.module_search_paths_set` is set
Avoid mixing declarations and code in the C API to fix the compiler warning: "ISO C90 forbids mixed declarations and code" [-Werror=declaration-after-statement]. Patch by Victor Stinner.
Remove the token.h
header file. There was never any public tokenizer C
API. The token.h
header file was only designed to be used by Python
internals. Patch by Victor Stinner.
Remove legacy Unicode APIs based on Py_UNICODE*
.
Remove the PyUnicode_InternImmortal()
function and the
SSTATE_INTERNED_IMMORTAL
macro. Patch by Victor Stinner.
Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets the vectorcall field of a given :c:type:`PyFunctionObject`.
Warning: extensions using this API must preserve the behavior of the unaltered function!
Fixed an assert that prevented PyRun_InteractiveOne
from providing
tracebacks when parsing from the provided FD.
The :c:func:`PyType_FromSpec` API will now find and use a metaclass based on the provided bases. An error will be raised if there is a metaclass conflict.