Python 3.15.0a3

This commit is contained in:
Hugo van Kemenade 2025-12-16 14:25:53 +02:00
parent 1cc7551b3f
commit f1eb0c0b0c
166 changed files with 2053 additions and 664 deletions

View file

@ -29,7 +29,7 @@ and must be named after the module name plus an extension listed in
Extension export hook
.....................
.. versionadded:: next
.. versionadded:: 3.15
Support for the :samp:`PyModExport_{<name>}` export hook was added in Python
3.15. The older way of defining modules is still available: consult either
@ -191,7 +191,7 @@ the :c:data:`Py_mod_multiple_interpreters` slot.
``PyInit`` function
...................
.. deprecated:: next
.. deprecated:: 3.15
This functionality is :term:`soft deprecated`.
It will not get new features, but there are no plans to remove it.
@ -272,7 +272,7 @@ For example, a module called ``spam`` would be defined like this::
Legacy single-phase initialization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. deprecated:: next
.. deprecated:: 3.15
Single-phase initialization is :term:`soft deprecated`.
It is a legacy mechanism to initialize extension

View file

@ -142,7 +142,7 @@ Modules created using the C API are typically defined using an
array of :dfn:`slots`.
The slots provide a "description" of how a module should be created.
.. versionchanged:: next
.. versionchanged:: 3.15
Previously, a :c:type:`PyModuleDef` struct was necessary to define modules.
The older way of defining modules is still available: consult either the
@ -190,7 +190,7 @@ Metadata slots
However, it is still recommended to include this slot for introspection
and debugging purposes.
.. versionadded:: next
.. versionadded:: 3.15
Use :c:member:`PyModuleDef.m_name` instead to support previous versions.
@ -201,7 +201,7 @@ Metadata slots
Usually it is set to a variable created with :c:macro:`PyDoc_STRVAR`.
.. versionadded:: next
.. versionadded:: 3.15
Use :c:member:`PyModuleDef.m_doc` instead to support previous versions.
@ -332,7 +332,7 @@ Creation and initialization slots
.. versionadded:: 3.5
.. versionchanged:: next
.. versionchanged:: 3.15
The *slots* argument may be a ``ModuleSpec``-like object, rather than
a true :py:class:`~importlib.machinery.ModuleSpec` instance.
@ -365,7 +365,7 @@ Creation and initialization slots
.. versionadded:: 3.5
.. versionchanged:: next
.. versionchanged:: 3.15
Repeated ``Py_mod_exec`` slots are disallowed, except in
:c:type:`PyModuleDef.m_slots`.
@ -384,7 +384,7 @@ Creation and initialization slots
The table must be statically allocated (or otherwise guaranteed to outlive
the module object).
.. versionadded:: next
.. versionadded:: 3.15
Use :c:member:`PyModuleDef.m_methods` instead to support previous versions.
@ -434,7 +434,7 @@ To retrieve the state from a given module, use the following functions:
On error, set *\*result* to -1, and return -1 with an exception set.
.. versionadded:: next
.. versionadded:: 3.15
@ -459,7 +459,7 @@ defining the module state.
Use :c:func:`PyModule_GetStateSize` to retrieve the size of a given module.
.. versionadded:: next
.. versionadded:: 3.15
Use :c:member:`PyModuleDef.m_size` instead to support previous versions.
@ -482,7 +482,7 @@ defining the module state.
(:c:data:`Py_mod_state_size`) is greater than 0 and the module state
(as returned by :c:func:`PyModule_GetState`) is ``NULL``.
.. versionadded:: next
.. versionadded:: 3.15
Use :c:member:`PyModuleDef.m_size` instead to support previous versions.
@ -510,7 +510,7 @@ defining the module state.
the cyclic garbage collector is not involved and
the :c:macro:`Py_mod_state_free` function is called directly.
.. versionadded:: next
.. versionadded:: 3.15
Use :c:member:`PyModuleDef.m_clear` instead to support previous versions.
@ -532,7 +532,7 @@ defining the module state.
(:c:data:`Py_mod_state_size`) is greater than 0 and the module state
(as returned by :c:func:`PyModule_GetState`) is ``NULL``.
.. versionadded:: next
.. versionadded:: 3.15
Use :c:member:`PyModuleDef.m_free` instead to support previous versions.
@ -593,7 +593,7 @@ A module's token -- and the *your_token* value to use in the above code -- is:
This means that :c:macro:`!Py_mod_token` cannot be used in
:c:member:`PyModuleDef.m_slots`.
.. versionadded:: next
.. versionadded:: 3.15
.. c:function:: int PyModule_GetToken(PyObject *module, void** result)
@ -601,7 +601,7 @@ A module's token -- and the *your_token* value to use in the above code -- is:
On error, set *\*result* to NULL, and return -1 with an exception set.
.. versionadded:: next
.. versionadded:: 3.15
See also :c:func:`PyType_GetModuleByToken`.
@ -641,7 +641,7 @@ rather than from an extension's :ref:`export hook <extension-export-hook>`.
:c:func:`!PyModule_FromSlotsAndSpec` call.
In particular, it may be heap-allocated.
.. versionadded:: next
.. versionadded:: 3.15
.. c:function:: int PyModule_Exec(PyObject *module)
@ -654,7 +654,7 @@ rather than from an extension's :ref:`export hook <extension-export-hook>`.
:ref:`legacy single-phase initialization <single-phase-initialization>`,
this function does nothing and returns 0.
.. versionadded:: next
.. versionadded:: 3.15

View file

@ -111,7 +111,7 @@ Object Protocol
object type name: str
object repr : 'abcdef'
.. versionadded:: next
.. versionadded:: 3.15
.. c:function:: int PyObject_HasAttrWithError(PyObject *o, PyObject *attr_name)

View file

@ -317,7 +317,7 @@ Type Objects
and other places where a method's defining class cannot be passed using the
:c:type:`PyCMethod` calling convention.
.. versionadded:: next
.. versionadded:: 3.15
.. c:function:: PyObject* PyType_GetModuleByDef(PyTypeObject *type, struct PyModuleDef *def)

View file

@ -1370,7 +1370,7 @@ behavior::
>>> parser.parse_args('--foo XXX'.split())
Namespace(bar='XXX')
.. versionchanged:: next
.. versionchanged:: 3.15
Single-dash long option now takes precedence over short options.
@ -1473,7 +1473,7 @@ this API may be passed as the ``action`` parameter to
.. versionadded:: 3.9
.. versionchanged:: next
.. versionchanged:: 3.15
Added support for single-dash options.
Added support for alternate prefix_chars_.

View file

@ -118,7 +118,7 @@ The :mod:`gc` module provides the following functions:
.. versionadded:: 3.4
.. versionchanged:: next
.. versionchanged:: 3.15
Add ``duration`` and ``candidates``.
@ -340,7 +340,7 @@ values but should not rebind them):
.. versionadded:: 3.3
.. versionchanged:: next
.. versionchanged:: 3.15
Add "duration" and "candidates".

View file

@ -210,7 +210,7 @@ Functions
:exc:`ModuleNotFoundError` is raised when the module being reloaded lacks
a :class:`~importlib.machinery.ModuleSpec`.
.. versionchanged:: next
.. versionchanged:: 3.15
If *module* is a lazy module that has not yet been materialized (i.e.,
loaded via :class:`importlib.util.LazyLoader` and not yet accessed),
calling :func:`reload` is a no-op and returns the module unchanged.

View file

@ -252,7 +252,7 @@ Startup hooks
function has been set. This function only exists if Python was compiled
for a version of the library that supports it.
.. versionadded:: next
.. versionadded:: 3.15
.. _readline-completion:

View file

@ -482,7 +482,7 @@ The AF_* and SOCK_* constants are now :class:`AddressFamily` and
.. versionchanged:: 3.14
Added support for ``TCP_QUICKACK`` on Windows platforms when available.
.. versionchanged:: next
.. versionchanged:: 3.15
``IPV6_HDRINCL`` was added.

View file

@ -2640,7 +2640,7 @@ Notes on using *__slots__*:
of the iterator's values. However, the *__slots__* attribute will be an empty
iterator.
.. versionchanged:: next
.. versionchanged:: 3.15
Allowed defining the *__dict__* and *__weakref__* *__slots__* for any class.

View file

@ -344,7 +344,7 @@ General Options
"_tkinter": "Install the python-tk package to use tkinter",
}
.. versionadded:: next
.. versionadded:: 3.15
.. option:: --enable-pystats

View file

@ -24,10 +24,10 @@
#define PY_MINOR_VERSION 15
#define PY_MICRO_VERSION 0
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
#define PY_RELEASE_SERIAL 2
#define PY_RELEASE_SERIAL 3
/* Version as a string */
#define PY_VERSION "3.15.0a2+"
#define PY_VERSION "3.15.0a3"
/*--end constants--*/

View file

@ -1,4 +1,4 @@
# Autogenerated by Sphinx on Tue Nov 18 16:51:09 2025
# Autogenerated by Sphinx on Tue Dec 16 14:26:04 2025
# as part of the release process.
topics = {
@ -865,9 +865,9 @@ Notes on using *__slots__*:
renders the meaning of the program undefined. In the future, a
check may be added to prevent this.
* "TypeError" will be raised if nonempty *__slots__* are defined for a
class derived from a ""variable-length" built-in type" such as
"int", "bytes", and "tuple".
* "TypeError" will be raised if *__slots__* other than *__dict__* and
*__weakref__* are defined for a class derived from a ""variable-
length" built-in type" such as "int", "bytes", and "tuple".
* Any non-string *iterable* may be assigned to *__slots__*.
@ -887,6 +887,9 @@ Notes on using *__slots__*:
* If an *iterator* is used for *__slots__* then a *descriptor* is
created for each of the iterators values. However, the *__slots__*
attribute will be an empty iterator.
Changed in version 3.15.0a2 (unreleased): Allowed defining the
*__dict__* and *__weakref__* *__slots__* for any class.
''',
'attribute-references': r'''Attribute references
********************
@ -2112,7 +2115,7 @@ ensures that the type of the target "e" is consistently
... except* BlockingIOError as e:
... print(repr(e))
...
ExceptionGroup('', (BlockingIOError()))
ExceptionGroup('', (BlockingIOError(),))
"break", "continue" and "return" cannot appear in an "except*" clause.
@ -2784,7 +2787,7 @@ a subject value:
If only keyword patterns are present, they are processed as
follows, one by one:
I. The keyword is looked up as an attribute on the subject.
1. The keyword is looked up as an attribute on the subject.
* If this raises an exception other than "AttributeError", the
exception bubbles up.
@ -2796,14 +2799,14 @@ a subject value:
the class pattern fails; if this succeeds, the match proceeds
to the next keyword.
II. If all keyword patterns succeed, the class pattern succeeds.
2. If all keyword patterns succeed, the class pattern succeeds.
If any positional patterns are present, they are converted to
keyword patterns using the "__match_args__" attribute on the class
"name_or_attr" before matching:
I. The equivalent of "getattr(cls, "__match_args__", ())" is
called.
1. The equivalent of "getattr(cls, "__match_args__", ())" is
called.
* If this raises an exception, the exception bubbles up.
@ -2824,9 +2827,9 @@ a subject value:
Customizing positional arguments in class pattern matching
II. Once all positional patterns have been converted to keyword
patterns,
the match proceeds as if there were only keyword patterns.
2. Once all positional patterns have been converted to keyword
patterns, the match proceeds as if there were only keyword
patterns.
For the following built-in types the handling of positional
subpatterns is different:
@ -6020,7 +6023,9 @@ The available presentation types for "float" and "Decimal" values are:
| | With no precision given, uses a precision of "6" digits |
| | after the decimal point for "float", and shows all |
| | coefficient digits for "Decimal". If "p=0", the decimal |
| | point is omitted unless the "#" option is used. |
| | point is omitted unless the "#" option is used. For |
| | "float", the exponent always contains at least two digits, |
| | and is zero if the value is zero. |
+-----------+------------------------------------------------------------+
| "'E'" | Scientific notation. Same as "'e'" except it uses an upper |
| | case E as the separator character. |
@ -6484,78 +6489,31 @@ trailing underscore characters:
"NAME" tokens represent *identifiers*, *keywords*, and *soft
keywords*.
Within the ASCII range (U+0001..U+007F), the valid characters for
names include the uppercase and lowercase letters ("A-Z" and "a-z"),
the underscore "_" and, except for the first character, the digits "0"
through "9".
Names are composed of the following characters:
* uppercase and lowercase letters ("A-Z" and "a-z"),
* the underscore ("_"),
* digits ("0" through "9"), which cannot appear as the first
character, and
* non-ASCII characters. Valid names may only contain letter-like and
digit-like characters; see Non-ASCII characters in names for
details.
Names must contain at least one character, but have no upper length
limit. Case is significant.
Besides "A-Z", "a-z", "_" and "0-9", names can also use letter-like
and number-like characters from outside the ASCII range, as detailed
below.
Formally, names are described by the following lexical definitions:
All identifiers are converted into the normalization form NFKC while
parsing; comparison of identifiers is based on NFKC.
NAME: name_start name_continue*
name_start: "a"..."z" | "A"..."Z" | "_" | <non-ASCII character>
name_continue: name_start | "0"..."9"
identifier: <NAME, except keywords>
Formally, the first character of a normalized identifier must belong
to the set "id_start", which is the union of:
* Unicode category "<Lu>" - uppercase letters (includes "A" to "Z")
* Unicode category "<Ll>" - lowercase letters (includes "a" to "z")
* Unicode category "<Lt>" - titlecase letters
* Unicode category "<Lm>" - modifier letters
* Unicode category "<Lo>" - other letters
* Unicode category "<Nl>" - letter numbers
* {""_""} - the underscore
* "<Other_ID_Start>" - an explicit set of characters in PropList.txt
to support backwards compatibility
The remaining characters must belong to the set "id_continue", which
is the union of:
* all characters in "id_start"
* Unicode category "<Nd>" - decimal numbers (includes "0" to "9")
* Unicode category "<Pc>" - connector punctuations
* Unicode category "<Mn>" - nonspacing marks
* Unicode category "<Mc>" - spacing combining marks
* "<Other_ID_Continue>" - another explicit set of characters in
PropList.txt to support backwards compatibility
Unicode categories use the version of the Unicode Character Database
as included in the "unicodedata" module.
These sets are based on the Unicode standard annex UAX-31. See also
**PEP 3131** for further details.
Even more formally, names are described by the following lexical
definitions:
NAME: xid_start xid_continue*
id_start: <Lu> | <Ll> | <Lt> | <Lm> | <Lo> | <Nl> | "_" | <Other_ID_Start>
id_continue: id_start | <Nd> | <Pc> | <Mn> | <Mc> | <Other_ID_Continue>
xid_start: <all characters in id_start whose NFKC normalization is
in (id_start xid_continue*)">
xid_continue: <all characters in id_continue whose NFKC normalization is
in (id_continue*)">
identifier: <NAME, except keywords>
A non-normative listing of all valid identifier characters as defined
by Unicode is available in the DerivedCoreProperties.txt file in the
Unicode Character Database.
Note that not all names matched by this grammar are valid; see Non-
ASCII characters in names for details.
Keywords
@ -6638,6 +6596,101 @@ trailing underscore characters:
context of a class definition, are re-written to use a mangled form
to help avoid name clashes between private attributes of base and
derived classes. See section Identifiers (Names).
Non-ASCII characters in names
=============================
Names that contain non-ASCII characters need additional normalization
and validation beyond the rules and grammar explained above. For
example, "ř_1", "", or "साँप" are valid names, but "r〰2", "", or
"🐍" are not.
This section explains the exact rules.
All names are converted into the normalization form NFKC while
parsing. This means that, for example, some typographic variants of
characters are converted to their basic form. For example,
"fiⁿₐˡᵢᶻₐᵗᵢᵒₙ" normalizes to "finalization", so Python treats them as
the same name:
>>> fiⁿₐˡᵢᶻₐᵗᵢᵒₙ = 3
>>> finalization
3
Note:
Normalization is done at the lexical level only. Run-time functions
that take names as *strings* generally do not normalize their
arguments. For example, the variable defined above is accessible at
run time in the "globals()" dictionary as
"globals()["finalization"]" but not "globals()["fiⁿₐˡᵢᶻₐᵗᵢᵒₙ"]".
Similarly to how ASCII-only names must contain only letters, digits
and the underscore, and cannot start with a digit, a valid name must
start with a character in the letter-like set "xid_start", and the
remaining characters must be in the letter- and digit-like set
"xid_continue".
These sets based on the *XID_Start* and *XID_Continue* sets as defined
by the Unicode standard annex UAX-31. Pythons "xid_start"
additionally includes the underscore ("_"). Note that Python does not
necessarily conform to UAX-31.
A non-normative listing of characters in the *XID_Start* and
*XID_Continue* sets as defined by Unicode is available in the
DerivedCoreProperties.txt file in the Unicode Character Database. For
reference, the construction rules for the "xid_*" sets are given
below.
The set "id_start" is defined as the union of:
* Unicode category "<Lu>" - uppercase letters (includes "A" to "Z")
* Unicode category "<Ll>" - lowercase letters (includes "a" to "z")
* Unicode category "<Lt>" - titlecase letters
* Unicode category "<Lm>" - modifier letters
* Unicode category "<Lo>" - other letters
* Unicode category "<Nl>" - letter numbers
* {""_""} - the underscore
* "<Other_ID_Start>" - an explicit set of characters in PropList.txt
to support backwards compatibility
The set "xid_start" then closes this set under NFKC normalization, by
removing all characters whose normalization is not of the form
"id_start id_continue*".
The set "id_continue" is defined as the union of:
* "id_start" (see above)
* Unicode category "<Nd>" - decimal numbers (includes "0" to "9")
* Unicode category "<Pc>" - connector punctuations
* Unicode category "<Mn>" - nonspacing marks
* Unicode category "<Mc>" - spacing combining marks
* "<Other_ID_Continue>" - another explicit set of characters in
PropList.txt to support backwards compatibility
Again, "xid_continue" closes this set under NFKC normalization.
Unicode categories use the version of the Unicode Character Database
as included in the "unicodedata" module.
See also:
* **PEP 3131** Supporting Non-ASCII Identifiers
* **PEP 672** Unicode-related Security Considerations for Python
''',
'if': r'''The "if" statement
******************
@ -8956,9 +9009,9 @@ Notes on using *__slots__*:
renders the meaning of the program undefined. In the future, a
check may be added to prevent this.
* "TypeError" will be raised if nonempty *__slots__* are defined for a
class derived from a ""variable-length" built-in type" such as
"int", "bytes", and "tuple".
* "TypeError" will be raised if *__slots__* other than *__dict__* and
*__weakref__* are defined for a class derived from a ""variable-
length" built-in type" such as "int", "bytes", and "tuple".
* Any non-string *iterable* may be assigned to *__slots__*.
@ -8979,6 +9032,9 @@ Notes on using *__slots__*:
created for each of the iterators values. However, the *__slots__*
attribute will be an empty iterator.
Changed in version 3.15.0a2 (unreleased): Allowed defining the
*__dict__* and *__weakref__* *__slots__* for any class.
Customizing class creation
==========================
@ -10150,10 +10206,14 @@ str.format(*args, **kwargs)
the numeric index of a positional argument, or the name of a
keyword argument. Returns a copy of the string where each
replacement field is replaced with the string value of the
corresponding argument.
corresponding argument. For example:
>>> "The sum of 1 + 2 is {0}".format(1+2)
'The sum of 1 + 2 is 3'
>>> "The sum of 1 + 2 is {0}".format(1+2)
'The sum of 1 + 2 is 3'
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
'The sum of 1 + 2 is 3'
>>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
'Nobody expects the Spanish Inquisition!'
See Format String Syntax for a description of the various
formatting options that can be specified in format strings.
@ -10208,13 +10268,28 @@ str.isalpha()
database as Letter, i.e., those with general category property
being one of Lm, Lt, Lu, Ll, or Lo. Note that this is
different from the Alphabetic property defined in the section 4.10
Letters, Alphabetic, and Ideographic of the Unicode Standard.
Letters, Alphabetic, and Ideographic of the Unicode Standard. For
example:
>>> 'Letters and spaces'.isalpha()
False
>>> 'LettersOnly'.isalpha()
True
>>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical too
True
See Unicode Properties.
str.isascii()
Return "True" if the string is empty or all characters in the
string are ASCII, "False" otherwise. ASCII characters have code
points in the range U+0000-U+007F.
points in the range U+0000-U+007F. For example:
>>> 'ASCII characters'.isascii()
True
>>> 'µ'.isascii()
False
Added in version 3.7.
@ -10223,8 +10298,16 @@ str.isdecimal()
Return "True" if all characters in the string are decimal
characters and there is at least one character, "False" otherwise.
Decimal characters are those that can be used to form numbers in
base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a decimal
character is a character in the Unicode General Category Nd.
base 10, such as U+0660, ARABIC-INDIC DIGIT ZERO. Formally a
decimal character is a character in the Unicode General Category
Nd. For example:
>>> '0123456789'.isdecimal()
True
>>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # Arabic-Indic digits zero to nine
True
>>> 'alphabetic'.isdecimal()
False
str.isdigit()
@ -10267,7 +10350,19 @@ str.isnumeric()
that have the Unicode numeric value property, e.g. U+2155, VULGAR
FRACTION ONE FIFTH. Formally, numeric characters are those with
the property value Numeric_Type=Digit, Numeric_Type=Decimal or
Numeric_Type=Numeric.
Numeric_Type=Numeric. For example:
>>> '0123456789'.isnumeric()
True
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine
True
>>> ''.isnumeric() # Vulgar fraction one fifth
True
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
(False, True, True)
See also "isdecimal()" and "isdigit()". Numeric characters are a
superset of decimal numbers.
str.isprintable()
@ -10333,7 +10428,15 @@ str.join(iterable, /)
Return a string which is the concatenation of the strings in
*iterable*. A "TypeError" will be raised if there are any non-
string values in *iterable*, including "bytes" objects. The
separator between elements is the string providing this method.
separator between elements is the string providing this method. For
example:
>>> ', '.join(['spam', 'spam', 'spam'])
'spam, spam, spam'
>>> '-'.join('Python')
'P-y-t-h-o-n'
See also "split()".
str.ljust(width, fillchar=' ', /)
@ -10342,6 +10445,17 @@ str.ljust(width, fillchar=' ', /)
space). The original string is returned if *width* is less than or
equal to "len(s)".
For example:
>>> 'Python'.ljust(10)
'Python '
>>> 'Python'.ljust(10, '.')
'Python....'
>>> 'Monty Python'.ljust(10, '.')
'Monty Python'
See also "rjust()".
str.lower()
Return a copy of the string with all the cased characters [4]
@ -10543,6 +10657,8 @@ str.split(sep=None, maxsplit=-1)
>>> " foo ".split(maxsplit=0)
['foo ']
See also "join()".
str.splitlines(keepends=False)
Return a list of the lines in the string, breaking at line
@ -11046,119 +11162,56 @@ f-strings
Added in version 3.6.
Changed in version 3.7: The "await" and "async for" can be used in
expressions within f-strings.
Changed in version 3.8: Added the debug specifier ("=")
Changed in version 3.12: Many restrictions on expressions within
f-strings have been removed. Notably, nested strings, comments, and
backslashes are now permitted.
A *formatted string literal* or *f-string* is a string literal that is
prefixed with "f" or "F". These strings may contain replacement
fields, which are expressions delimited by curly braces "{}". While
other string literals always have a constant value, formatted strings
are really expressions evaluated at run time.
prefixed with "f" or "F". Unlike other string literals, f-strings
do not have a constant value. They may contain *replacement fields*
delimited by curly braces "{}". Replacement fields contain expressions
which are evaluated at run time. For example:
Escape sequences are decoded like in ordinary string literals (except
when a literal is also marked as a raw string). After decoding, the
grammar for the contents of the string is:
>>> who = 'nobody'
>>> nationality = 'Spanish'
>>> f'{who.title()} expects the {nationality} Inquisition!'
'Nobody expects the Spanish Inquisition!'
f_string: (literal_char | "{{" | "}}" | replacement_field)*
replacement_field: "{" f_expression ["="] ["!" conversion] [":" format_spec] "}"
f_expression: (conditional_expression | "*" or_expr)
("," conditional_expression | "," "*" or_expr)* [","]
| yield_expression
conversion: "s" | "r" | "a"
format_spec: (literal_char | replacement_field)*
literal_char: <any code point except "{", "}" or NULL>
Any doubled curly braces ("{{" or "}}") outside replacement fields are
replaced with the corresponding single curly brace:
The parts of the string outside curly braces are treated literally,
except that any doubled curly braces "'{{'" or "'}}'" are replaced
with the corresponding single curly brace. A single opening curly
bracket "'{'" marks a replacement field, which starts with a Python
expression. To display both the expression text and its value after
evaluation, (useful in debugging), an equal sign "'='" may be added
after the expression. A conversion field, introduced by an exclamation
point "'!'" may follow. A format specifier may also be appended,
introduced by a colon "':'". A replacement field ends with a closing
curly bracket "'}'".
>>> print(f'{{...}}')
{...}
Other characters outside replacement fields are treated like in
ordinary string literals. This means that escape sequences are decoded
(except when a literal is also marked as a raw string), and newlines
are possible in triple-quoted f-strings:
>>> name = 'Galahad'
>>> favorite_color = 'blue'
>>> print(f'{name}:\\t{favorite_color}')
Galahad: blue
>>> print(rf"C:\\Users\\{name}")
C:\\Users\\Galahad
>>> print(f\'\'\'Three shall be the number of the counting
... and the number of the counting shall be three.\'\'\')
Three shall be the number of the counting
and the number of the counting shall be three.
Expressions in formatted string literals are treated like regular
Python expressions surrounded by parentheses, with a few exceptions.
An empty expression is not allowed, and both "lambda" and assignment
expressions ":=" must be surrounded by explicit parentheses. Each
expression is evaluated in the context where the formatted string
literal appears, in order from left to right. Replacement expressions
can contain newlines in both single-quoted and triple-quoted f-strings
and they can contain comments. Everything that comes after a "#"
inside a replacement field is a comment (even closing braces and
quotes). In that case, replacement fields must be closed in a
different line.
Python expressions. Each expression is evaluated in the context where
the formatted string literal appears, in order from left to right. An
empty expression is not allowed, and both "lambda" and assignment
expressions ":=" must be surrounded by explicit parentheses:
>>> f"abc{a # This is a comment }"
... + 3}"
'abc5'
Changed in version 3.7: Prior to Python 3.7, an "await" expression and
comprehensions containing an "async for" clause were illegal in the
expressions in formatted string literals due to a problem with the
implementation.
Changed in version 3.12: Prior to Python 3.12, comments were not
allowed inside f-string replacement fields.
When the equal sign "'='" is provided, the output will have the
expression text, the "'='" and the evaluated value. Spaces after the
opening brace "'{'", within the expression and after the "'='" are all
retained in the output. By default, the "'='" causes the "repr()" of
the expression to be provided, unless there is a format specified.
When a format is specified it defaults to the "str()" of the
expression unless a conversion "'!r'" is declared.
Added in version 3.8: The equal sign "'='".
If a conversion is specified, the result of evaluating the expression
is converted before formatting. Conversion "'!s'" calls "str()" on
the result, "'!r'" calls "repr()", and "'!a'" calls "ascii()".
The result is then formatted using the "format()" protocol. The
format specifier is passed to the "__format__()" method of the
expression or conversion result. An empty string is passed when the
format specifier is omitted. The formatted result is then included in
the final value of the whole string.
Top-level format specifiers may include nested replacement fields.
These nested fields may include their own conversion fields and format
specifiers, but may not include more deeply nested replacement fields.
The format specifier mini-language is the same as that used by the
"str.format()" method.
Formatted string literals may be concatenated, but replacement fields
cannot be split across literals.
Some examples of formatted string literals:
>>> name = "Fred"
>>> f"He said his name is {name!r}."
"He said his name is 'Fred'."
>>> f"He said his name is {repr(name)}." # repr() is equivalent to !r
"He said his name is 'Fred'."
>>> width = 10
>>> precision = 4
>>> value = decimal.Decimal("12.34567")
>>> f"result: {value:{width}.{precision}}" # nested fields
'result: 12.35'
>>> today = datetime(year=2017, month=1, day=27)
>>> f"{today:%B %d, %Y}" # using date format specifier
'January 27, 2017'
>>> f"{today=:%B %d, %Y}" # using date format specifier and debugging
'today=January 27, 2017'
>>> number = 1024
>>> f"{number:#0x}" # using integer format specifier
'0x400'
>>> foo = "bar"
>>> f"{ foo = }" # preserves whitespace
" foo = 'bar'"
>>> line = "The mill's closed"
>>> f"{line = }"
'line = "The mill\\'s closed"'
>>> f"{line = :20}"
"line = The mill's closed "
>>> f"{line = !r:20}"
'line = "The mill\\'s closed" '
>>> f'{(half := 1/2)}, {half * 42}'
'0.5, 21.0'
Reusing the outer f-string quoting type inside a replacement field is
permitted:
@ -11167,10 +11220,6 @@ permitted:
>>> f"abc {a["x"]} def"
'abc 2 def'
Changed in version 3.12: Prior to Python 3.12, reuse of the same
quoting type of the outer f-string inside a replacement field was not
possible.
Backslashes are also allowed in replacement fields and are evaluated
the same way as in any other context:
@ -11181,21 +11230,84 @@ the same way as in any other context:
b
c
Changed in version 3.12: Prior to Python 3.12, backslashes were not
permitted inside an f-string replacement field.
It is possible to nest f-strings:
Formatted string literals cannot be used as docstrings, even if they
do not include expressions.
>>> name = 'world'
>>> f'Repeated:{f' hello {name}' * 3}'
'Repeated: hello world hello world hello world'
Portable Python programs should not use more than 5 levels of nesting.
**CPython implementation detail:** CPython does not limit nesting of
f-strings.
Replacement expressions can contain newlines in both single-quoted and
triple-quoted f-strings and they can contain comments. Everything that
comes after a "#" inside a replacement field is a comment (even
closing braces and quotes). This means that replacement fields with
comments must be closed in a different line:
>>> a = 2
>>> f"abc{a # This comment }" continues until the end of the line
... + 3}"
'abc5'
After the expression, replacement fields may optionally contain:
* a *debug specifier* an equal sign ("="), optionally surrounded by
whitespace on one or both sides;
* a *conversion specifier* "!s", "!r" or "!a"; and/or
* a *format specifier* prefixed with a colon (":").
See the Standard Library section on f-strings for details on how these
fields are evaluated.
As that section explains, *format specifiers* are passed as the second
argument to the "format()" function to format a replacement field
value. For example, they can be used to specify a field width and
padding characters using the Format Specification Mini-Language:
>>> number = 14.3
>>> f'{number:20.7f}'
' 14.3000000'
Top-level format specifiers may include nested replacement fields:
>>> field_size = 20
>>> precision = 7
>>> f'{number:{field_size}.{precision}f}'
' 14.3000000'
These nested fields may include their own conversion fields and format
specifiers:
>>> number = 3
>>> f'{number:{field_size}}'
' 3'
>>> f'{number:{field_size:05}}'
'00000000000000000003'
However, these nested fields may not include more deeply nested
replacement fields.
Formatted string literals cannot be used as *docstrings*, even if they
do not include expressions:
>>> def foo():
... f"Not a docstring"
...
>>> foo.__doc__ is None
True
>>> print(foo.__doc__)
None
See also **PEP 498** for the proposal that added formatted string
literals, and "str.format()", which uses a related format string
mechanism.
See also:
* **PEP 498** Literal String Interpolation
* **PEP 701** Syntactic formalization of f-strings
* "str.format()", which uses a related format string mechanism.
t-strings
@ -11204,34 +11316,90 @@ t-strings
Added in version 3.14.
A *template string literal* or *t-string* is a string literal that is
prefixed with "t" or "T". These strings follow the same syntax and
evaluation rules as formatted string literals, with the following
differences:
prefixed with "t" or "T". These strings follow the same syntax
rules as formatted string literals. For differences in evaluation
rules, see the Standard Library section on t-strings
* Rather than evaluating to a "str" object, template string literals
evaluate to a "string.templatelib.Template" object.
* The "format()" protocol is not used. Instead, the format specifier
and conversions (if any) are passed to a new "Interpolation" object
that is created for each evaluated expression. It is up to code that
processes the resulting "Template" object to decide how to handle
format specifiers and conversions.
Formal grammar for f-strings
============================
* Format specifiers containing nested replacement fields are evaluated
eagerly, prior to being passed to the "Interpolation" object. For
instance, an interpolation of the form "{amount:.{precision}f}" will
evaluate the inner expression "{precision}" to determine the value
of the "format_spec" attribute. If "precision" were to be "2", the
resulting format specifier would be "'.2f'".
F-strings are handled partly by the *lexical analyzer*, which produces
the tokens "FSTRING_START", "FSTRING_MIDDLE" and "FSTRING_END", and
partly by the parser, which handles expressions in the replacement
field. The exact way the work is split is a CPython implementation
detail.
* When the equals sign "'='" is provided in an interpolation
expression, the text of the expression is appended to the literal
string that precedes the relevant interpolation. This includes the
equals sign and any surrounding whitespace. The "Interpolation"
instance for the expression will be created as normal, except that
"conversion" will be set to "r" ("repr()") by default. If an
explicit conversion or format specifier are provided, this will
override the default behaviour.
Correspondingly, the f-string grammar is a mix of lexical and
syntactic definitions.
Whitespace is significant in these situations:
* There may be no whitespace in "FSTRING_START" (between the prefix
and quote).
* Whitespace in "FSTRING_MIDDLE" is part of the literal string
contents.
* In "fstring_replacement_field", if "f_debug_specifier" is present,
all whitespace after the opening brace until the
"f_debug_specifier", as well as whitespace immediately following
"f_debug_specifier", is retained as part of the expression.
**CPython implementation detail:** The expression is not handled in
the tokenization phase; it is retrieved from the source code using
locations of the "{" token and the token after "=".
The "FSTRING_MIDDLE" definition uses negative lookaheads ("!") to
indicate special characters (backslash, newline, "{", "}") and
sequences ("f_quote").
fstring: FSTRING_START fstring_middle* FSTRING_END
FSTRING_START: fstringprefix ("'" | '"' | "\'\'\'" | '"""')
FSTRING_END: f_quote
fstringprefix: <("f" | "fr" | "rf"), case-insensitive>
f_debug_specifier: '='
f_quote: <the quote character(s) used in FSTRING_START>
fstring_middle:
| fstring_replacement_field
| FSTRING_MIDDLE
FSTRING_MIDDLE:
| (!"\\" !newline !'{' !'}' !f_quote) source_character
| stringescapeseq
| "{{"
| "}}"
| <newline, in triple-quoted f-strings only>
fstring_replacement_field:
| '{' f_expression [f_debug_specifier] [fstring_conversion]
[fstring_full_format_spec] '}'
fstring_conversion:
| "!" ("s" | "r" | "a")
fstring_full_format_spec:
| ':' fstring_format_spec*
fstring_format_spec:
| FSTRING_MIDDLE
| fstring_replacement_field
f_expression:
| ','.(conditional_expression | "*" or_expr)+ [","]
| yield_expression
Note:
In the above grammar snippet, the "f_quote" and "FSTRING_MIDDLE"
rules are context-sensitive they depend on the contents of
"FSTRING_START" of the nearest enclosing "fstring".Constructing a
more traditional formal grammar from this template is left as an
exercise for the reader.
The grammar for t-strings is identical to the one for f-strings, with
*t* instead of *f* at the beginning of rule and token names and in the
prefix.
tstring: TSTRING_START tstring_middle* TSTRING_END
<rest of the t-string grammar is omitted; see above>
''',
'subscriptions': r'''Subscriptions
*************
@ -11480,7 +11648,7 @@ ensures that the type of the target "e" is consistently
... except* BlockingIOError as e:
... print(repr(e))
...
ExceptionGroup('', (BlockingIOError()))
ExceptionGroup('', (BlockingIOError(),))
"break", "continue" and "return" cannot appear in an "except*" clause.
@ -11790,7 +11958,7 @@ There are currently two intrinsic set types:
Sets
These represent a mutable set. They are created by the built-in
"set()" constructor and can be modified afterwards by several
methods, such as "add".
methods, such as "add()".
Frozen sets
These represent an immutable set. They are created by the built-in
@ -12239,41 +12407,25 @@ module.__path__
module.__file__
module.__cached__
"__file__" is an optional attribute that may or may not be set.
Both attributes should be a "str" when they are available.
"__file__" and "__cached__" are both optional attributes that may
or may not be set. Both attributes should be a "str" when they are
available.
"__file__" indicates the pathname of the file from which the module
was loaded (if loaded from a file), or the pathname of the shared
library file for extension modules loaded dynamically from a shared
library. It might be missing for certain types of modules, such as
C modules that are statically linked into the interpreter, and the
import system may opt to leave it unset if it has no semantic
meaning (for example, a module loaded from a database).
If "__file__" is set then the "__cached__" attribute might also be
set, which is the path to any compiled version of the code (for
example, a byte-compiled file). The file does not need to exist to
set this attribute; the path can simply point to where the compiled
file *would* exist (see **PEP 3147**).
Note that "__cached__" may be set even if "__file__" is not set.
However, that scenario is quite atypical. Ultimately, the *loader*
is what makes use of the module spec provided by the *finder* (from
which "__file__" and "__cached__" are derived). So if a loader can
load from a cached module but otherwise does not load from a file,
that atypical scenario may be appropriate.
It is **strongly** recommended that you use
"module.__spec__.cached" instead of "module.__cached__".
An optional attribute, "__file__" indicates the pathname of the
file from which the module was loaded (if loaded from a file), or
the pathname of the shared library file for extension modules
loaded dynamically from a shared library. It might be missing for
certain types of modules, such as C modules that are statically
linked into the interpreter, and the import system may opt to leave
it unset if it has no semantic meaning (for example, a module
loaded from a database).
Deprecated since version 3.13, removed in version 3.15: Setting
"__cached__" on a module while failing to set "__spec__.cached" is
deprecated. In Python 3.15, "__cached__" will cease to be set or
taken into consideration by the import system or standard library.
Changed in version 3.15: "__cached__" is no longer set.
Other writable attributes on module objects
-------------------------------------------
@ -12957,10 +13109,6 @@ class dict(iterable, /, **kwargs)
the keyword argument replaces the value from the positional
argument.
Providing keyword arguments as in the first example only works for
keys that are valid Python identifiers. Otherwise, any valid keys
can be used.
Dictionaries compare equal if and only if they have the same "(key,
value)" pairs (regardless of ordering). Order comparisons (<,
<=, >=, >) raise "TypeError". To illustrate dictionary

1605
Misc/NEWS.d/3.15.0a3.rst Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,3 +0,0 @@
Honor :option:`--with-platlibdir` in the pure-Python standard library
installation path, if ``PLATLIBDIR`` doesn't match the value used in
``LIBDIR``.

View file

@ -1,4 +0,0 @@
Add configure option :option:`--with-missing-stdlib-config=FILE` allows
which distributors to pass a `JSON <https://www.json.org/json-en.html>`_
configuration file containing custom error messages for missing
:term:`standard library` modules.

View file

@ -1 +0,0 @@
Update to WASI SDK 29.

View file

@ -1,4 +0,0 @@
Fix ``_remote_debugging_module.c`` compilation on 32-bit Linux. Include
Python.h before system headers to make sure that
``_remote_debugging_module.c`` uses the same types (ABI) than Python. Patch
by Victor Stinner.

View file

@ -1,4 +0,0 @@
When running ``make clean-retain-profile``, keep the
generated JIT stencils. That way, the stencils are not generated twice when
Profile-guided optimization (PGO) is used. It also allows distributors to
supply their own pre-built JIT stencils.

View file

@ -1,4 +0,0 @@
``RUNSHARED`` is no longer cleared when cross-compiling. Previously,
``RUNSHARED`` was cleared when cross-compiling, which breaks PGO when using
``--enabled-shared`` on systems where the cross-compiled CPython is otherwise
executable (e.g., via transparent emulation).

View file

@ -1 +0,0 @@
Do not generate the jit stencils twice in case of PGO builds on Windows.

View file

@ -1 +0,0 @@
Fixed a bug where JIT stencils produced on Windows contained debug data. Patch by Chris Eibl.

View file

@ -1,3 +0,0 @@
Allow ``--enable-wasm-dynamic-linking`` for WASI. While CPython doesn't
directly support it so external/downstream users do not have to patch in
support for the flag.

View file

@ -1,2 +0,0 @@
``build-details.py`` will only be installed as part of the main install
(``make install``). ``make altinstall`` will no longer include it.

View file

@ -1,4 +0,0 @@
When calculating the digest of the JIT stencils input, sort the hashed files
by filenames before adding their content to the hasher. This ensures
deterministic hash input and hence deterministic hash, independent on
filesystem order.

View file

@ -1,2 +0,0 @@
Add ``LDVERSION`` and ``EXE`` to the ``base_interpreter`` value of
``build-details.json``.

View file

@ -1,2 +0,0 @@
Expose the functions :c:func:`Py_SIZE`, :c:func:`Py_IS_TYPE` and
:c:func:`Py_SET_SIZE` in the Stable ABI.

View file

@ -1,2 +0,0 @@
Add :c:func:`PyUnstable_Object_Dump` to dump an object to ``stderr``. It should
only be used for debugging. Patch by Victor Stinner.

View file

@ -1 +0,0 @@
Removed the sqlite3_shutdown call that could cause closing connections for sqlite when used with multiple sub interpreters.

View file

@ -1 +0,0 @@
Add :c:func:`PyDict_SetDefaultRef` to the Stable ABI.

View file

@ -1,4 +0,0 @@
Fix :term:`free threading` race condition in
:c:func:`PyImport_AddModuleRef`. It was previously possible for two calls to
the function return two different objects, only one of which was stored in
:data:`sys.modules`.

View file

@ -1,2 +0,0 @@
Fix the ``HAVE_THREAD_LOCAL`` macro being defined without the
``Py_BUILD_CORE`` macro set after including :file:`Python.h`.

View file

@ -1,5 +0,0 @@
:c:func:`!_PyObject_CallMethodId`, :c:func:`!_PyObject_GetAttrId` and
:c:func:`!_PyUnicode_FromId` are deprecated since 3.15 and will be removed in
3.20. Instead, use :c:func:`PyUnicode_InternFromString()` and cache the result in
the module state, then call :c:func:`PyObject_CallMethod` or
:c:func:`PyObject_GetAttr`. Patch by Victor Stinner.

View file

@ -1 +0,0 @@
Fixed the :c:macro:`PyABIInfo_VAR` macro.

View file

@ -1 +0,0 @@
:c:func:`!PyUnstable_CopyPerfMapFile` now checks that opening the file succeeded before flushing.

View file

@ -1,2 +0,0 @@
Fix :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary()` handling of
tagged ints on the interpreter stack.

View file

@ -1 +0,0 @@
Eliminate redundant refcounting from ``_CALL_TUPLE_1``. Patch by Noam Cohen

View file

@ -1 +0,0 @@
Eliminate redundant refcounting from ``_CALL_BUILTIN_O``.

View file

@ -1 +0,0 @@
Eliminate redundant refcounting from ``_CALL_STR_1``.

View file

@ -1,2 +0,0 @@
For the free-threaded build, avoid locking the :class:`set` object for the
``__contains__`` method.

View file

@ -1 +0,0 @@
Fix a bug during JIT compilation failure which caused garbage collection debug assertions to fail.

View file

@ -1,3 +0,0 @@
Change ``backoff counter`` to use prime numbers instead of powers of 2.
Use only 3 bits for ``counter`` and 13 bits for ``value``.
This allows to support values up to 8191. Patch by Mikhail Efimov.

View file

@ -1 +0,0 @@
Improve multithreaded scaling of dataclasses on the free-threaded build.

View file

@ -1,2 +0,0 @@
Allowed defining the *__dict__* and *__weakref__* :ref:`__slots__ <slots>`
for any class.

View file

@ -1,4 +0,0 @@
Only raise a ``RecursionError`` or trigger a fatal error if the stack
pointer is both below the limit pointer *and* above the stack base. If
outside of these bounds assume that it is OK. This prevents false positives
when user-space threads swap stacks.

View file

@ -1,2 +0,0 @@
Expose a ``"duration"`` stat in :func:`gc.get_stats` and
:data:`gc.callbacks`.

View file

@ -1,2 +0,0 @@
Ensure the :meth:`~object.__repr__` for :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` does
not change when the exception sequence that was original passed in to its constructor is subsequently mutated.

View file

@ -1,2 +0,0 @@
Fix :c:macro:`Py_mod_gil` with API added in :pep:`793`:
:c:func:`!PyModule_FromSlotsAndSpec` and ``PyModExport`` hooks

View file

@ -1,2 +0,0 @@
Expose a ``"candidates"`` stat in :func:`gc.get_stats` and
:data:`gc.callbacks`.

View file

@ -1,2 +0,0 @@
Fix inconsistent state when enabling or disabling monitoring events too many
times.

View file

@ -1,6 +0,0 @@
Add incomplete sample detection to prevent corrupted profiling data. Each
thread state now contains an embedded base frame (sentinel at the bottom of
the frame stack) with owner type ``FRAME_OWNED_BY_INTERPRETER``. The profiler
validates that stack unwinding terminates at this sentinel frame. Samples that
fail to reach the base frame (due to race conditions, memory corruption, or
other errors) are now rejected rather than being included as spurious data.

View file

@ -1,2 +0,0 @@
When importing a module, use Python's regular file object to ensure that
writes to ``.pyc`` files are complete or an appropriate error is raised.

View file

@ -1 +0,0 @@
Fix invalid memory read in the ``ENTER_EXECUTOR`` instruction.

View file

@ -1 +0,0 @@
Protect against specialization failures in the tracing JIT compiler for performance reasons.

View file

@ -1,2 +0,0 @@
Raise :exc:`ValueError` instead of crashing when empty string is used as a name
in ``_imp.create_builtin()``.

View file

@ -1,2 +0,0 @@
Raise :exc:`ModuleNotFoundError` instead of crashing when a nonexistent module
is used as a name in ``_imp.create_builtin()``.

View file

@ -1,2 +0,0 @@
Annotate anonymous mmap usage only when supported by the
Linux kernel and if ``-X dev`` is used or Python is built in debug mode. Patch by Donghee Na.

View file

@ -1 +0,0 @@
Stop setting ``__cached__`` on modules.

View file

@ -1,2 +0,0 @@
Fix quadratically increasing garbage collection delays in free-threaded
build.

View file

@ -1,3 +0,0 @@
Remove all ``*.load_module()`` usage and definitions from the import system
and importlib. The method has been deprecated in favor of
``importlib.abc.Loader.exec_module()`` since Python 3.4.

View file

@ -1 +0,0 @@
Check against abstract stack overflow in the JIT optimizer.

View file

@ -1,2 +0,0 @@
Fix crash when inserting into a split table dictionary with a non
:class:`str` key that matches an existing key.

View file

@ -1 +0,0 @@
Fix missing type watcher when promoting attribute loads to constants in the JIT. Patch by Ken Jin. Reproducer by Yuancheng Jiang.

View file

@ -1,6 +0,0 @@
Implement a limited form of register allocation known as "top of stack
caching" in the JIT. It works by keeping 0-3 of the top items in the stack
in registers. The code generator generates multiple versions of those uops
that do not escape and are relatively small. During JIT compilation, the
copy that produces the least memory traffic is selected, spilling or
reloading values when needed.

View file

@ -1 +0,0 @@
Decrease the size of the generated stencils and the runtime JIT code. Patch by Diego Russo.

View file

@ -1,4 +0,0 @@
Fix incorrect keyword suggestions for syntax errors in :mod:`traceback`. The
keyword typo suggestion mechanism would incorrectly suggest replacements when
the extracted source code was incomplete rather than containing an actual typo.
Patch by Pablo Galindo.

View file

@ -1,3 +0,0 @@
Improve the "Perhaps you forgot a comma?" syntax error for multi-line string
concatenations to point to the last string instead of the first, making it
easier to locate where the comma is missing. Patch by Pablo Galindo.

View file

@ -1 +0,0 @@
Fix SIGILL crash on m68k due to incorrect assembly constraint.

View file

@ -1,2 +0,0 @@
Make the attributes in :mod:`zlib` thread-safe on the :term:`free threaded
<free threading>` build.

View file

@ -1,3 +0,0 @@
Fix reference counting when adjacent literal parts are merged while constructing
:class:`string.templatelib.Template`, preventing the displaced string object
from leaking.

View file

@ -1,5 +0,0 @@
Fix a free-threaded GC performance regression. If there are many untracked
tuples, the GC will run too often, resulting in poor performance. The fix
is to include untracked tuples in the "long lived" object count. The number
of frozen objects is also now included since the free-threaded GC must
scan those too.

View file

@ -1,2 +0,0 @@
Fix a crash in :func:`divmod` when :func:`!_pylong.int_divmod` does not
return a tuple of length two exactly. Patch by Bénédikt Tran.

View file

@ -1 +0,0 @@
Eliminate redundant refcounting from ``_CALL_LIST_APPEND``.

View file

@ -1,2 +0,0 @@
Make the attributes in :mod:`bz2` thread-safe on the :term:`free threaded
<free threading>` build.

View file

@ -1,3 +0,0 @@
Tracebacks will be displayed in fallback mode even if :func:`io.open` is lost.
Previously, this would crash the interpreter.
Patch by Bartosz Sławecki.

View file

@ -1 +0,0 @@
JIT: Fix segfault caused by not flushing the stack to memory at side exits.

View file

@ -1 +0,0 @@
Eliminate redundant refcounting from ``_STORE_ATTR_INSTANCE_VALUE``.

View file

@ -1,4 +0,0 @@
:mod:`xml.sax.handler`: Make Documentation of
:data:`xml.sax.handler.feature_external_ges` warn of opening up to `external
entity attacks <https://en.wikipedia.org/wiki/XML_external_entity_attack>`_.
Patch by Sebastian Pipping.

View file

@ -1 +0,0 @@
Fix support for namespace packages in :mod:`modulefinder`.

View file

@ -1,7 +0,0 @@
Fix a potential memory denial of service in the :mod:`pickle` module.
When reading a pickled data received from untrusted source, it could cause
an arbitrary amount of memory to be allocated, even if the code that is
allowed to execute is restricted by overriding the
:meth:`~pickle.Unpickler.find_class` method.
This could have led to symptoms including a :exc:`MemoryError`, swapping, out
of memory (OOM) killed processes or containers, or even system crashes.

View file

@ -1 +0,0 @@
Add ``__all__`` to :mod:`tkinter.simpledialog`.

View file

@ -1,4 +0,0 @@
Fixed :func:`subprocess.Popen.communicate` ``input=`` handling of :class:`memoryview`
instances that were non-byte shaped on POSIX platforms. Those are now properly
cast to a byte shaped view instead of truncating the input. Windows platforms
did not have this bug.

View file

@ -1,2 +0,0 @@
Flag: a ``dir()`` on a ``Flag`` enumeration now shows non-canonical members.
(i.e. aliases).

View file

@ -1,3 +0,0 @@
Add parsing for ``References`` and ``In-Reply-To`` headers to the :mod:`email`
library that parses the header content as lists of message id tokens. This
prevents them from being folded incorrectly.

View file

@ -1,2 +0,0 @@
Add support for single-dash long options and alternate prefix characters in
:class:`argparse.BooleanOptionalAction`.

View file

@ -1,4 +0,0 @@
Fix inferring *dest* from a single-dash long option in :mod:`argparse`. If a
short option and a single-dash long option are passed to
:meth:`!add_argument`, *dest* is now inferred from the single-dash long
option.

View file

@ -1 +0,0 @@
Make importlib.reload no-op for lazy modules.

View file

@ -1,2 +0,0 @@
:mod:`pydoc`: Fix :exc:`DeprecationWarning` being raised when generating doc for
:term:`stdlib` modules.

View file

@ -1 +0,0 @@
Distinguish stdout and stderr when colorizing output in argparse module.

View file

@ -1,4 +0,0 @@
Add heatmap visualization mode to the Tachyon sampling profiler. The new
``--heatmap`` output format provides a line-by-line view showing execution
intensity with color-coded samples, inline statistics, and interactive call
graph navigation between callers and callees.

View file

@ -1,3 +0,0 @@
Fix handling of unclosed character references (named and numerical)
followed by the end of file in :class:`html.parser.HTMLParser` with
``convert_charrefs=False``.

View file

@ -1,3 +0,0 @@
:mod:`collections`: Ensure that the methods ``UserString.rindex()`` and
``UserString.index()`` accept :class:`collections.UserString` instances as the
sub argument.

View file

@ -1,2 +0,0 @@
Make csv module thread-safe on the :term:`free threaded <free threading>`
build.

View file

@ -1,2 +0,0 @@
Remove a copy from :meth:`io.RawIOBase.read`. If the underlying I/O class
keeps a reference to the mutable memory, raise a :exc:`BufferError`.

View file

@ -1 +0,0 @@
Add async-aware profiling to the Tachyon sampling profiler. The profiler now reconstructs and displays async task hierarchies in flamegraphs, making the output more actionable for users. Patch by Savannah Ostrowski and Pablo Galindo Salgado.

View file

@ -1,3 +0,0 @@
Add :func:`readline.get_pre_input_hook` function to retrieve the current
pre-input hook. This allows applications to save and restore the hook
without overwriting user settings. Patch by Sanyam Khurana.

View file

@ -1 +0,0 @@
Fix musl version detection on Void Linux.

View file

@ -1 +0,0 @@
Fix :mod:`doctest` to correctly report line numbers for doctests in ``__test__`` dictionary when formatted as triple-quoted strings by finding unique lines in the string and matching them in the source file.

View file

@ -1 +0,0 @@
Check ``stdin`` instead of ``stdout`` for ``use_rawinput`` in :mod:`pdb`.

View file

@ -1,4 +0,0 @@
Add a new ``--live`` mode to the tachyon profiler in
:mod:`!profiling.sampling` module. This mode consist of a live TUI that
displays real-time profiling statistics as the target application runs,
similar to ``top``. Patch by Pablo Galindo

Some files were not shown because too many files have changed in this diff Show more