Skip to content

Commit ee8f452

Browse files
authored
Merge branch 'main' into jit_record_family
2 parents 5617cec + 5dd2161 commit ee8f452

205 files changed

Lines changed: 6536 additions & 2328 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ jobs:
283283
- { name: openssl, version: 3.4.5 }
284284
- { name: openssl, version: 3.5.6 }
285285
- { name: openssl, version: 3.6.2 }
286+
- { name: openssl, version: 4.0.0 }
286287
## AWS-LC
287288
- { name: aws-lc, version: 1.72.1 }
288289
env:

Doc/c-api/synchronization.rst

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ there is no :c:type:`PyObject` -- for example, when working with a C type that
8484
does not extend or wrap :c:type:`PyObject` but still needs to call into the C
8585
API in a manner that might lead to deadlocks.
8686
87-
The functions and structs used by the macros are exposed for cases
88-
where C macros are not available. They should only be used as in the
89-
given macro expansions. Note that the sizes and contents of the structures may
90-
change in future Python versions.
91-
9287
.. note::
9388
9489
Operations that need to lock two objects at once must use
@@ -114,12 +109,15 @@ section API avoids potential deadlocks due to reentrancy and lock ordering
114109
by allowing the runtime to temporarily suspend the critical section if the
115110
code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
116111
112+
.. _critical-section-macros:
113+
117114
.. c:macro:: Py_BEGIN_CRITICAL_SECTION(op)
118115
119116
Acquires the per-object lock for the object *op* and begins a
120117
critical section.
121118
122-
In the free-threaded build, this macro expands to::
119+
In the free-threaded build, and when building for the
120+
:ref:`Stable ABI <stable-abi>`, this macro expands to::
123121
124122
{
125123
PyCriticalSection _py_cs;
@@ -150,7 +148,8 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
150148
151149
Ends the critical section and releases the per-object lock.
152150
153-
In the free-threaded build, this macro expands to::
151+
In the free-threaded build, and when building for the
152+
:ref:`Stable ABI <stable-abi>`, this macro expands to::
154153
155154
PyCriticalSection_End(&_py_cs);
156155
}
@@ -179,7 +178,8 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
179178
180179
Locks the mutexes *m1* and *m2* and begins a critical section.
181180
182-
In the free-threaded build, this macro expands to::
181+
In the free-threaded build, and when building for the
182+
:ref:`Stable ABI <stable-abi>`, this macro expands to::
183183
184184
{
185185
PyCriticalSection2 _py_cs2;
@@ -196,7 +196,8 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
196196
197197
Ends the critical section and releases the per-object locks.
198198
199-
In the free-threaded build, this macro expands to::
199+
In the free-threaded build, and when building for the
200+
:ref:`Stable ABI <stable-abi>`, this macro expands to::
200201
201202
PyCriticalSection2_End(&_py_cs2);
202203
}
@@ -205,6 +206,48 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
205206
206207
.. versionadded:: 3.13
207208
209+
Low-level critical section API
210+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211+
212+
The following functions and structs are exposed for cases where C macros
213+
are not available.
214+
215+
.. c:function:: void PyCriticalSection_Begin(PyCriticalSection *c, PyObject *op)
216+
void PyCriticalSection_End(PyCriticalSection *c)
217+
void PyCriticalSection2_Begin(PyCriticalSection2 *c, PyObject *a, PyObject *b)
218+
void PyCriticalSection2_End(PyCriticalSection2 *c);
219+
220+
To be used only as in the macro expansions
221+
listed :ref:`earlier in this section <critical-section-macros>`.
222+
223+
In non-:term:`free-threaded <free threading>` builds of CPython, these
224+
functions do nothing.
225+
226+
.. versionadded:: 3.13
227+
228+
.. c:type:: PyCriticalSection
229+
PyCriticalSection2
230+
231+
To be used only as in the macro expansions
232+
listed :ref:`earlier in this section <critical-section-macros>`.
233+
Note that the contents of the structures are private and their meaning may
234+
change in future Python versions.
235+
236+
.. versionadded:: 3.13
237+
238+
.. c:function:: void PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *m);
239+
void PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2);
240+
241+
.. (These need to be in a separate section without a Stable ABI anotation.)
242+
243+
To be used only as in the macro expansions
244+
listed :ref:`earlier in this section <critical-section-macros>`.
245+
246+
In non-:term:`free-threaded <free threading>` builds of CPython, these
247+
functions do nothing.
248+
249+
.. versionadded:: 3.14
250+
208251
209252
Legacy locking APIs
210253
-------------------

Doc/data/stable_abi.dat

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/library/argparse.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -637,25 +637,22 @@ are set.
637637

638638
.. versionadded:: 3.14
639639

640-
To highlight inline code in your description or epilog text, you can use
641-
backticks::
640+
To highlight inline code in your description, epilog, or argument ``help``
641+
text, you can use single or double backticks::
642642

643643
>>> parser = argparse.ArgumentParser(
644644
... formatter_class=argparse.RawDescriptionHelpFormatter,
645+
... description='Run ``python -m myapp`` to start.',
645646
... epilog='''Examples:
646647
... `python -m myapp --verbose`
647-
... `python -m myapp --config settings.json`
648+
... ``python -m myapp --config settings.json``
648649
... ''')
650+
>>> parser.add_argument('--foo', help='set the `foo` value')
649651

650652
When colors are enabled, the text inside backticks will be displayed in a
651653
distinct color to help examples stand out. When colors are disabled, backticks
652654
are preserved as-is, which is readable in plain text.
653655

654-
.. note::
655-
656-
Backtick markup only applies to description and epilog text. It does not
657-
apply to individual argument ``help`` strings.
658-
659656
.. versionadded:: 3.15
660657

661658

Doc/library/array.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ defined:
4848
+-----------+--------------------+-------------------+-----------------------+-------+
4949
| ``'d'`` | double | float | 8 | |
5050
+-----------+--------------------+-------------------+-----------------------+-------+
51-
| ``'F'`` | float complex | complex | 8 | \(4) |
51+
| ``'Zf'`` | float complex | complex | 8 | \(4) |
5252
+-----------+--------------------+-------------------+-----------------------+-------+
53-
| ``'D'`` | double complex | complex | 16 | \(4) |
53+
| ``'Zd'`` | double complex | complex | 16 | \(4) |
5454
+-----------+--------------------+-------------------+-----------------------+-------+
5555

5656

@@ -80,7 +80,7 @@ Notes:
8080
.. versionadded:: 3.15
8181

8282
(4)
83-
Complex types (``F`` and ``D``) are available unconditionally,
83+
Complex types (``Zf`` and ``Zd``) are available unconditionally,
8484
regardless on support for complex types (the Annex G of the C11 standard)
8585
by the C compiler.
8686
As specified in the C11 standard, each complex type is represented by a
@@ -105,7 +105,10 @@ The module defines the following item:
105105

106106
.. data:: typecodes
107107

108-
A string with all available type codes.
108+
A tuple with all available type codes.
109+
110+
.. versionchanged:: next
111+
The type changed from :class:`str` to :class:`tuple`.
109112

110113

111114
The module defines the following type:

Doc/library/calendar.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,11 @@ The following options are accepted:
756756
By default, today's date is highlighted in color and can be
757757
:ref:`controlled using environment variables <using-on-controlling-color>`.
758758

759+
.. versionchanged:: next
760+
By default, the month is now also highlighted in color, and
761+
the days of the week are also in color. This behavior can be
762+
:ref:`controlled using environment variables <using-on-controlling-color>`.
763+
759764
*HTML-mode options:*
760765

761766
.. option:: --css CSS, -c CSS

Doc/library/ctypes.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,19 @@ in both C and ``libffi``, the following complex types are available:
370370
* - :class:`c_float_complex`
371371
- :c:expr:`float complex`
372372
- :py:class:`complex`
373-
- ``'F'``
373+
- ``'Zf'``
374374
* - :class:`c_double_complex`
375375
- :c:expr:`double complex`
376376
- :py:class:`complex`
377-
- ``'D'``
377+
- ``'Zd'``
378378
* - :class:`c_longdouble_complex`
379379
- :c:expr:`long double complex`
380380
- :py:class:`complex`
381-
- ``'G'``
381+
- ``'Zg'``
382+
383+
.. versionchanged:: next
384+
The :py:attr:`~_SimpleCData._type_` types ``F``, ``D`` and ``G`` have been
385+
replaced with ``Zf``, ``Zd`` and ``Zg``.
382386

383387

384388
All these types can be created by calling them with an optional initializer of

Doc/library/inspect.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1833,8 +1833,15 @@ from the command line.
18331833

18341834
By default, accepts the name of a module and prints the source of that
18351835
module. A class or function within the module can be printed instead by
1836-
appended a colon and the qualified name of the target object.
1836+
appending a colon and the qualified name of the target object.
18371837

18381838
.. option:: --details
18391839

18401840
Print information about the specified object rather than the source code
1841+
1842+
.. versionchanged:: next
1843+
1844+
The ``--details`` option now supports basic introspection for modules
1845+
without available source code and indicates when modules are frozen.
1846+
It also indicates when the given target reference is not the canonical
1847+
name of the referenced object.

Doc/library/ipaddress.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ write code that handles both IP versions correctly. Address objects are
367367

368368
.. attribute:: ipv4_mapped
369369

370-
For addresses that appear to be IPv4 mapped addresses (starting with
371-
``::FFFF/96``), this property will report the embedded IPv4 address.
372-
For any other address, this property will be ``None``.
370+
For addresses that appear to be IPv4 mapped addresses in the range
371+
``::FFFF:0:0/96`` as defined by :RFC:`4291`, this property reports the
372+
embedded IPv4 address. For any other address, this property will be ``None``.
373373

374374
.. attribute:: scope_id
375375

Doc/library/struct.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ platform-dependent.
264264
+--------+--------------------------+--------------------+----------------+------------+
265265
| ``D`` | :c:expr:`double complex` | complex | 16 | \(10) |
266266
+--------+--------------------------+--------------------+----------------+------------+
267+
| ``Zf`` | :c:expr:`float complex` | complex | 8 | \(10) |
268+
+--------+--------------------------+--------------------+----------------+------------+
269+
| ``Zd`` | :c:expr:`double complex` | complex | 16 | \(10) |
270+
+--------+--------------------------+--------------------+----------------+------------+
267271
| ``s`` | :c:expr:`char[]` | bytes | | \(9) |
268272
+--------+--------------------------+--------------------+----------------+------------+
269273
| ``p`` | :c:expr:`char[]` | bytes | | \(8) |
@@ -280,6 +284,9 @@ platform-dependent.
280284
.. versionchanged:: 3.14
281285
Added support for the ``'F'`` and ``'D'`` formats.
282286

287+
.. versionchanged:: next
288+
Added support for the ``'Zf'`` and ``'Zd'`` formats.
289+
283290
.. seealso::
284291

285292
The :mod:`array` and :ref:`ctypes <ctypes-fundamental-data-types>` modules,
@@ -372,7 +379,7 @@ Notes:
372379
For the ``'F'`` and ``'D'`` format characters, the packed representation uses
373380
the IEEE 754 binary32 and binary64 format for components of the complex
374381
number, regardless of the floating-point format used by the platform.
375-
Note that complex types (``F`` and ``D``) are available unconditionally,
382+
Note that complex types (``F``/``Zf`` and ``D``/``Zd``) are available unconditionally,
376383
despite complex types being an optional feature in C.
377384
As specified in the C11 standard, each complex type is represented by a
378385
two-element C array containing, respectively, the real and imaginary parts.

0 commit comments

Comments
 (0)