Refactored the instruction sequence data structure out of compile.c into instruction_sequence.c.
Introduce a unified 16-bit backoff counter type (_Py_BackoffCounter
),
shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The
API used for adaptive specialization counters is changed but the behavior is
(supposed to be) identical.
The behavior of the Tier 2 counters is changed:
- There are no longer dynamic thresholds (we never varied these).
- All counters now use the same exponential backoff.
- The counter for
JUMP_BACKWARD
starts counting down from 16. - The
temperature
in side exits starts counting down from 64.
Improve the performance of the following :class:`bytes` and :class:`bytearray` methods by adapting them to the :c:macro:`METH_FASTCALL` calling convention:
Improve the performance of the following :class:`str` methods by adapting them to the :c:macro:`METH_FASTCALL` calling convention:
- :meth:`~str.count`
- :meth:`~str.endswith`
- :meth:`~str.find`
- :meth:`~str.index`
- :meth:`~str.rfind`
- :meth:`~str.rindex`
- :meth:`~str.startswith`
Move PyFutureFeatures
to an internal header and make it private.
Added handle of incorrect star expressions, e.g f(3, *)
. Patch by
Grigoryev Semyon
Fix crashes for certain user-created subclasses of :class:`ast.AST`. Such
classes are now expected to set the _field_types
attribute.
Updated the :mod:`hashlib` built-in HACL* project C code from upstream that we use for many implementations when they are not present via OpenSSL in a given build. This also avoids the rare potential for a C symbol name one definition rule linking issue.
Change the old space bit of objects in the young generation from 0 to gcstate->visited, so that any objects created during GC will have the old bit set correctly if they get moved into the old generation.
The cycle GC now chooses the size of increments based on the total heap size, instead of the rate of object creation. This ensures that it can keep up with growing heaps.
For INSTRUMENTED_CALL_FUNCTION_EX
, set arg0
to
sys.monitoring.MISSING
instead of None
for :monitoring-event:`CALL`
event.
Starting new threads and process creation through :func:`os.fork` are now only prevented once all non-daemon threads exit.
Ensure INSTRUMENTED_CALL_FUNCTION_EX
always emits
:monitoring-event:`CALL`
list.sort()
now exploits more cases of partial ordering, particularly
those with long descending runs with sub-runs of equal values. Those are
recognized as single runs now (previously, each block of repeated values
caused a new run to be created).
Added a Loader that can discover extension modules in an iOS-style Frameworks folder.
Compiler populates the new __static_attributes__
field on a class with
the names of attributes of this class which are accessed through self.X from
any function in its body.
The array of values, the PyDictValues
struct is now embedded in the
object during allocation. This provides better performance in the common
case, and does not degrade as much when the object's __dict__
is
materialized.
Implement an incremental cyclic garbage collector. By collecting the old generation in increments, there is no need for a full heap scan. This can hugely reduce maximum pause time for programs with large heaps.
Reduce the number of generations from three to two. The old generation is split into two spaces, "visited" and "pending".
Collection happens in two steps:: * An increment is formed from the young generation and a small part of the pending space. * This increment is scanned and the survivors moved to the end of the visited space.
When the collecting space becomes empty, the two spaces are swapped.
Dataclasses now calls :func:`exec` once per dataclass, instead of once per method being added. This can speed up dataclass creation by up to 20%.
Mime type text/rtf
is now supported by :mod:`mimetypes`.
Improve the :exc:`SyntaxError` that happens when 'not' appears after an operator. Patch by Pablo Galindo
Improve performance of :func:`os.path.join` and :func:`os.path.expanduser`.
Raise :exc:`TypeError` for non-paths in :func:`posixpath.relpath`.
Preserve mailbox ownership when rewriting in :func:`mailbox.mbox.flush`. Patch by Tony Mountifield.
Raise :exc:`FileNotFoundError` when getcwd()
returns '(unreachable)',
which can happen on Linux >= 2.6.36 with glibc < 2.27.
:meth:`asyncio.asyncio.run_coroutine_threadsafe` now keeps the traceback of :class:`CancelledError`, :class:`TimeoutError` and :class:`InvalidStateError` which are raised in the coroutine.
Fix error message for :func:`ntpath.commonpath`.
Deprecate undocumented :func:`!glob.glob0` and :func:`!glob.glob1` functions. Use :func:`glob.glob` and pass a directory to its root_dir argument instead.
Optimise several functions in :mod:`os.path`.
Refactored :meth:`configparser.RawConfigParser._read` to reduce cyclometric complexity and improve comprehensibility.
Raise TypeError for non-sequences for :func:`ntpath.commonpath`.
:class:`configparser.ConfigParser` now accepts unnamed sections before named ones, if configured to do so.
In documentation of :class:`gzip.GzipFile` in module gzip, explain data type
of optional constructor argument mtime, and recommend mtime = 0
for
generating deterministic streams.
Fixed an unlikely early & extra Py_DECREF
triggered crash in :mod:`ssl`
when creating a new _ssl._SSLContext
if CPython was built implausibly
such that the default cipher list is empty or the SSL library it was
linked against reports a failure from its C SSL_CTX_set_cipher_list()
API.
A DocTestCase
now reports as skipped if all examples in the doctest are
skipped.
In :mod:`subprocess`, raise a more informative message when
stdout=STDOUT
.
doctest: only print "and X failed" when non-zero, don't pluralise "1 items". Patch by Hugo van Kemenade.
Speed up :func:`compileall.compile_dir` by 20% when using multiprocessing by
increasing chunksize
.
Fix regression in lazy loading of self-referential modules, introduced in gh-114781.
Fix :mod:`dis` module's handling of ENTER_EXECUTOR
instructions.
Lazy-loading of modules that modify their own __class__
no longer
reverts the __class__
to :class:`types.ModuleType`.
Fix :mod:`zipfile` extraction for directory entries with the name containing backslashes on Windows.
Make :func:`os.path.isdevdrive` available on all platforms. For those that
do not offer Dev Drives, it will always return False
.
Fix a bug that prevents subclasses of :class:`typing.Any` to be instantiated with arguments. Patch by Chris Fu.
Deferred select imports in importlib.metadata and importlib.resources for a 14% speedup.
Start the deprecation period for the current behavior of
:func:`datetime.datetime.strptime` and :func:`time.strptime` which always
fails to parse a date string with a :exc:`ValueError` involving a day of
month such as strptime("02-29", "%m-%d")
when a year is not
specified and the date happen to be February 29th. This should help avoid
users finding new bugs every four years due to a natural mistaken assumption
about the API when parsing partial date values.
Fixed :func:`inspect.findsource` for class code objects.
Modify standard library to allow for iOS platform differences.
On Windows, :meth:`subprocess.Popen.wait` no longer calls
WaitForSingleObject()
with a negative timeout: pass 0
ms if the
timeout is negative. Patch by Victor Stinner.
configparser: Don't leave ConfigParser values in an invalid state (stored as a list instead of a str) after an earlier read raised DuplicateSectionError or DuplicateOptionError.
:class:`!_io.WindowsConsoleIO` now emit a warning if a boolean value is passed as a filedescriptor argument.
Ignore empty lines and comments in .pdbrc
Refreshed zipfile._path from zipp 3.18, providing
better compatibility for PyPy, better glob performance for deeply nested
zipfiles, and providing internal access to CompleteDirs.inject
for use
in other tests (like importlib.resources).
On Windows, :func:`time.time` now uses the
GetSystemTimePreciseAsFileTime()
clock to have a resolution better than
1 us, instead of the GetSystemTimeAsFileTime()
clock which has a
resolution of 15.6 ms. Patch by Victor Stinner.
Restore support of None
and other false values in :mod:`urllib.parse`
functions :func:`~urllib.parse.parse_qs` and
:func:`~urllib.parse.parse_qsl`. Also, they now raise a TypeError for
non-zero integers and non-empty sequences.
In PathFinder.invalidate_caches
, delegate to
MetadataPathFinder.invalidate_caches
.
Fix recursive child in dataclasses
Fixed various false positives and false negatives in
- :attr:`ipaddress.IPv4Address.is_private` (see these docs for details)
- :attr:`ipaddress.IPv4Address.is_global`
- :attr:`ipaddress.IPv6Address.is_private`
- :attr:`ipaddress.IPv6Address.is_global`
Also in the corresponding :class:`ipaddress.IPv4Network` and :class:`ipaddress.IPv6Network` attributes.
In :mod:`encodings.idna`, any capitalization of the ACE prefix
(xn--
) is now acceptable. Patch by Pepijn de Vos and Zackery Spytz.
Add :func:`platform.android_ver`, which provides device and OS information on Android.
Added new :func:`math.fma` function, wrapping C99's fma()
operation:
fused multiply-add function. Patch by Mark Dickinson and Victor Stinner.
The :mod:`importlib.resources` functions :func:`~importlib.resources.is_resource`, :func:`~importlib.resources.open_binary`, :func:`~importlib.resources.open_text`, :func:`~importlib.resources.path`, :func:`~importlib.resources.read_binary`, and :func:`~importlib.resources.read_text` are un-deprecated, and support subdirectories via multiple positional arguments. The :func:`~importlib.resources.contents` function also allows subdirectories, but remains deprecated.
Change automatically generated :class:`tkinter.Checkbutton` widget names to avoid collisions with automatically generated :class:`tkinter.ttk.Checkbutton` widget names within the same parent widget.
In :mod:`ctypes`, ctype data is now stored in type objects directly rather than in a dict subclass. This is an internal change that should not affect usage.
Fix blocking :func:`os.fwalk` and :func:`shutil.rmtree` on opening named pipe.
Implement :func:`ctypes.util.find_library` on Android.
Fix support of interval values > 1 in
:class:`logging.TimedRotatingFileHandler` for when='MIDNIGHT'
and
when='Wx'
.
Remove some internal protected parts from :mod:`uuid`:
_has_uuid_generate_time_safe
, _netbios_getnode
,
_ipconfig_getnode
, and _load_system_functions
. They were unused.
Fix the :mod:`ssl` module error handling of connection terminate by peer. It now throws an OSError with the appropriate error code instead of an EOFError.
Speed up :func:`os.path.realpath` on non-Windows platforms.
Fix a race in threading.Thread.join()
.
threading._MainThread
now always represents the main thread of the main
interpreter.
PyThreadState.on_delete
and PyThreadState.on_delete_data
have been
removed.
Add :meth:`asyncio.Server.close_clients` and :meth:`asyncio.Server.abort_clients` methods which allow to more forcefully close an asyncio server.
Changes Unicode codecs to return UnicodeEncodeError or UnicodeDecodeError, rather than just UnicodeError.
:mod:`pdb` now allows CLI arguments to pdb -m
.
Make completion of :mod:`pdb` similar to Python REPL
Fixed _get_slots
bug which caused error when defining dataclasses with
slots and a weakref_slot.
Add :py:class:`asyncio.Queue` termination with :py:meth:`~asyncio.Queue.shutdown` method.
The :mod:`zipimport` module can now read ZIP64 files.
:func:`asyncio.as_completed` now returns an object that is both an asynchronous iterator and plain iterator. The new asynchronous iteration pattern allows for easier correlation between prior tasks and their completed results. This is a closer match to :func:`concurrent.futures.as_completed`'s iteration pattern. Patch by Justin Arthur.
:func:`inspect.getsource` (and related functions) work with empty module
files, returning '\n'
(or reasonable equivalent) instead of raising
OSError
. Patch by Kernc.
Accept an iterable of separators in :meth:`asyncio.StreamReader.readuntil`, stopping when one of them is encountered.
Make :func:`mimetypes.guess_type` properly parsing of URLs with only a host name, URLs containing fragment or query, and filenames with only a UNC sharepoint on Windows. Based on patch by Dong-hee Na.
:meth:`unittest.TestLoader.discover` now saves the original value of
unittest.TestLoader._top_level_dir
and restores it at the end of the
call.
Remove compatibility references to Emscripten.
Add an iOS platform guide, and flag modules not available on iOS.
Changes to documentation files and config outputs to reflect the new location for reporting bugs - i.e. GitHub rather than bugs.python.org.
Disable JUnit XML output (--junit-xml=FILE
command line option) in
regrtest when hunting for reference leaks (-R
option). Patch by Victor
Stinner.
Fix XML tests for vanilla Expat <2.6.0.
Tests of TLS related things (error codes, etc) were updated to be more lenient about specific error message strings and behaviors as seen in the BoringSSL and AWS-LC forks of OpenSSL.
Consolidated tests for importlib.metadata in their own metadata
package.
Update test_importlib so that it passes under WASI SDK 21.
Add --tsan to test.regrtest for running TSAN tests in reasonable execution times. Patch by Donghee Na.
Added import helper isolated_modules
as CleanImport
does not remove
modules imported during the context. Use it in importlib.resources tests to
avoid leaving mod
around to impede importlib.metadata tests.
Have WASI builds use WASI SDK 21.
Skip building test modules that must be built as shared under WASI.
Add Android build script and instructions.
Ensure DirEntry.stat().st_ctime
behaves consistently with
:func:`os.stat` during the deprecation period of st_ctime
by containing
the same value as st_birthtime
. After the deprecation period,
st_ctime
will be the metadata change time (or unavailable through
DirEntry
), and only st_birthtime
will contain the creation time.
Improves performance of :func:`os.getppid` by using an alternate system API when available. Contributed by vxiiduu.
On Windows, :func:`time.monotonic` now uses the
QueryPerformanceCounter()
clock to have a resolution better than 1 us,
instead of the GetTickCount64()
clock which has a resolution of 15.6 ms.
Patch by Victor Stinner.
Fix instances of <_overlapped.Overlapped object at 0xXXX> still has
pending operation at deallocation, the process may crash
.
Fix the asyncio ProactorEventLoop implementation so that sending a datagram to an address that is not listening does not prevent receiving any more datagrams.
Switched from vendored libmpdecimal
code to a separately-hosted external
package in the cpython-source-deps
repository when building the
_decimal
module.
Fix PEP 737 implementation for %#T
and %#N
.
:c:func:`_PyBytes_Resize` can now be called for bytes objects with reference count > 1, including 1-byte bytes objects. It creates a new bytes object and destroys the old one if it has reference count > 1.
Fix integer overflow in :c:func:`PyLong_AsPid` on non-Windows 64-bit platforms.
:c:func:`!PyCode_GetFirstFree` is an ustable API now and has been renamed to :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan Romanyuk in :gh:`115781`)
Add test_cext
test: build a C extension to check if the Python C API
emits C compiler warnings. Patch by Victor Stinner.
Make the C API compatible with -Werror=declaration-after-statement
compiler flag again. Patch by Victor Stinner.
Add :c:func:`PyType_GetModuleByDef` to the limited C API. Patch by Victor Stinner.
Restore removed private _PyErr_ChainExceptions1()
function. Patch by
Victor Stinner.
In the limited C API version 3.13, getting Py_None
, Py_False
,
Py_True
, Py_Ellipsis
and Py_NotImplemented
singletons is now
implemented as function calls at the stable ABI level to hide implementation
details. Getting these constants still return borrowed references. Patch by
Victor Stinner.
Add :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` functions
to get constants. For example, Py_GetConstant(Py_CONSTANT_ZERO)
returns
a :term:`strong reference` to the constant zero. Patch by Victor Stinner.
Add support for %T
, %T#
, %N
and %N#
formats to
:c:func:`PyUnicode_FromFormat`: format the fully qualified name of an object
type and of a type: call :c:func:`PyType_GetModuleName`. See PEP 737 for
more information. Patch by Victor Stinner.
Add :c:func:`PyType_GetModuleName` function to get the type's module name.
Equivalent to getting the type.__module__
attribute. Patch by Eric Snow
and Victor Stinner.
Add :c:func:`PyType_GetFullyQualifiedName` function to get the type's fully
qualified name. Equivalent to f"{type.__module__}.{type.__qualname__}"
,
or type.__qualname__
if type.__module__
is not a string or is equal
to "builtins"
. Patch by Victor Stinner.
The fcntl
, grp
, pwd
, termios
, _statistics
and
_testconsole
C extensions are now built with the :ref:`limited C API
<limited-c-api>`. Patch by Victor Stinner.
Add additional flags to :c:func:`PyLong_AsNativeBytes` and :c:func:`PyLong_FromNativeBytes` to allow the caller to determine how to handle edge cases around values that fill the entire buffer.
Add :c:func:`PyObject_GenericHash` function.