8000 Merge branch 'main' into gh-115103-qsbr · colesbury/cpython@be441dc · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit be441dc

Browse files
committed
Merge branch 'main' into pythongh-115103-qsbr
2 parents 69d5669 + f366e21 commit be441dc

File tree

246 files changed

+4519
-1165
lines changed

Some content is hidden

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

246 files changed

+4519
-1165
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Programs/test_frozenmain.h generated
9494
Python/Python-ast.c generated
9595
Python/executor_cases.c.h generated
9696
Python/generated_cases.c.h generated
97-
Python/tier2_redundancy_eliminator_bytecodes.c.h generated
97+
Python/tier2_redundancy_eliminator_cases.c.h generated
9898
Python/opcode_targets.h generated
9999
Python/stdlib_module_names.h generated
100100
Tools/peg_generator/pegen/grammar_parser.py generated

.github/workflows/jit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ on:
44
paths:
55
- '**jit**'
66
- 'Python/bytecodes.c'
7+
- 'Python/optimizer*.c'
8+
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
79
push:
810
paths:
911
- '**jit**'
1012
- 'Python/bytecodes.c'
13+
- 'Python/optimizer*.c'
14+
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
1115
workflow_dispatch:
1216

1317
concurrency:

Doc/c-api/structures.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,26 +187,26 @@ Implementing functions and methods
187187
PyObject *kwargs);
188188
189189
190-
.. c:type:: _PyCFunctionFast
190+
.. c:type:: PyCFunctionFast
191191
192192
Type of the functions used to implement Python callables in C
193193
with signature :c:macro:`METH_FASTCALL`.
194194
The function signature is::
195195
196-
PyObject *_PyCFunctionFast(PyObject *self,
197-
PyObject *const *args,
198-
Py_ssize_t nargs);
196+
PyObject *PyCFunctionFast(PyObject *self,
197+
PyObject *const *args,
198+
Py_ssize_t nargs);
199199
200-
.. c:type:: _PyCFunctionFastWithKeywords
200+
.. c:type:: PyCFunctionFastWithKeywords
201201
202202
Type of the functions used to implement Python callables in C
203203
with signature :ref:`METH_FASTCALL | METH_KEYWORDS <METH_FASTCALL-METH_KEYWORDS>`.
204204
The function signature is::
205205
206-
PyObject *_PyCFunctionFastWithKeywords(PyObject *self,
207-
PyObject *const *args,
208-
Py_ssize_t nargs,
209-
PyObject *kwnames);
206+
PyObject *PyCFunctionFastWithKeywords(PyObject *self,
207+
PyObject *const *args,
208+
Py_ssize_t nargs,
209+
PyObject *kwnames);
210210
211211
.. c:type:: PyCMethod
212212
@@ -290,7 +290,7 @@ There are these calling conventions:
290290
.. c:macro:: METH_FASTCALL
291291
292292
Fast calling convention supporting only positional arguments.
293-
The methods have the type :c:type:`_PyCFunctionFast`.
293+
The methods have the type :c:type:`PyCFunctionFast`.
294294
The first parameter is *self*, the second parameter is a C array
295295
of :c:expr:`PyObject*` values indicating the arguments and the third
296296
parameter is the number of arguments (the length of the array).
@@ -306,7 +306,7 @@ There are these calling conventions:
306306
307307
:c:expr:`METH_FASTCALL | METH_KEYWORDS`
308308
Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments,
309-
with methods of type :c:type:`_PyCFunctionFastWithKeywords`.
309+
with methods of type :c:type:`PyCFunctionFastWithKeywords`.
310310
Keyword arguments are passed the same way as in the
311311
:ref:`vectorcall protocol <vectorcall>`:
312312
there is an additional fourth :c:expr:`PyObject*` parameter

Doc/data/stable_abi.dat

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

Doc/library/ctypes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,10 @@ compiler does it. It is possible to override this behavior by specifying a
670670
:attr:`~Structure._pack_` class attribute in the subclass definition.
671671
This must be set to a positive integer and specifies the maximum alignment for the fields.
672672
This is what ``#pragma pack(n)`` also does in MSVC.
673+
It is also possible to set a minimum alignment for how the subclass itself is packed in the
674+
same way ``#pragma align(n)`` works in MSVC.
675+
This can be achieved by specifying a ::attr:`~Structure._align_` class attribute
676+
in the subclass definition.
673677

674678
:mod:`ctypes` uses the native byte order for Structures and Unions. To build
675679
structures with non-native byte order, you can use one of the
@@ -2534,6 +2538,12 @@ fields, or any other data types containing pointer type fields.
25342538
Setting this attribute to 0 is the same as not setting it at all.
25352539

25362540

2541+
.. attribute:: _align_
2542+
2543+
An optional small integer that allows overriding the alignment of
2544+
the structure when being packed or unpacked to/from memory.
2545+
Setting this attribute to 0 is the same as not setting it at all.
2546+
25372547
.. attribute:: _anonymous_
25382548

25392549
An optional sequence that lists the names of unnamed (anonymous) fields.

Doc/library/dis.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ iterations of the loop.
16061606

16071607
value = STACK.pop()
16081608
result = func(value)
1609-
STACK.push(result)
1609+
STACK.append(result)
16101610

16111611
* ``oparg == 1``: call :func:`str` on *value*
16121612
* ``oparg == 2``: call :func:`repr` on *value*
@@ -1623,7 +1623,7 @@ iterations of the loop.
16231623

16241624
value = STACK.pop()
16251625
result = value.__format__("")
1626-
STACK.push(result)
1626+
STACK.append(result)
16271627

16281628
Used for implementing formatted literal strings (f-strings).
16291629

@@ -1636,7 +1636,7 @@ iterations of the loop.
16361636
spec = STACK.pop()
16371637
value = STACK.pop()
16381638
result = value.__format__(spec)
1639-
STACK.push(result)
1639+
STACK.append(result)
16401640

16411641
Used for implementing formatted literal strings (f-strings).
16421642

@@ -1783,7 +1783,7 @@ iterations of the loop.
17831783
arg2 = STACK.pop()
17841784
arg1 = STACK.pop()
17851785
result = intrinsic2(arg1, arg2)
1786-
STACK.push(result)
1786+
STACK.append(result)
17871787

17881788
The operand determines which intrinsic function is called:
17891789

Doc/library/exceptions.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,24 @@ The following exceptions are the exceptions that are usually raised.
416416
handling in C, most floating point operations are not checked.
417417

418418

419+
.. exception:: PythonFinalizationError
420+
421+
This exception is derived from :exc:`RuntimeError`. It is raised when
422+
an operation is blocked during interpreter shutdown also known as
423+
:term:`Python finalization <interpreter shutdown>`.
424+
425+
Examples of operations which can be blocked with a
426+
:exc:`PythonFinalizationError` during the Python finalization:
427+
428+
* Creating a new Python thread.
429+
* :func:`os.fork`.
430+
431+
See also the :func:`sys.is_finalizing` function.
432+
433+
.. versionadded:: 3.13
434+
Previously, a plain :exc:`RuntimeError` was raised.
435+
436+
419437
.. exception:: RecursionError
420438

421439
This exception is derived from :exc:`RuntimeError`. It is raised when the

Doc/library/inspect.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
340340
Functions wrapped in :func:`functools.partial` now return ``True`` if the
341341
wrapped function is a Python generator function.
342342

343+
.. versionchanged:: 3.13
344+
Functions wrapped in :func:`functools.partialmethod` now return ``True``
345+
if the wrapped function is a Python generator function.
343346

344347
.. function:: isgenerator(object)
345348

@@ -363,6 +366,10 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
363366
Sync functions marked with :func:`markcoroutinefunction` now return
364367
``True``.
365368

369+
.. versionchanged:: 3.13
370+
Functions wrapped in :func:`functools.partialmethod` now return ``True``
371+
if the wrapped function is a :term:`coroutine function`.
372+
366373

367374
.. function:: markcoroutinefunction(func)
368375

@@ -429,6 +436,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
429436
Functions wrapped in :func:`functools.partial` now return ``True`` if the
430437
wrapped function is a :term:`asynchronous generator` function.
431438

439+
.. versionchanged:: 3.13
440+
Functions wrapped in :func:`functools.partialmethod` now return ``True``
441+
if the wrapped function is a :term:`coroutine function`.
432442

433443
.. function:: isasyncgen(object)
434444

Doc/library/profile.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ functions:
299299
Create a :class:`~pstats.Stats` object based on the current
300300
profile and print the results to stdout.
301301

302+
The *sort* parameter specifies the sorting order of the displayed
303+
statistics. It accepts a single key or a tuple of keys to enable
304+
multi-level sorting, as in :func:`Stats.sort_stats <pstats.Stats.sort_stats>`.
305+
306+
.. versionadded:: 3.13
307+
:meth:`~Profile.print_stats` now accepts a tuple of keys.
308+
302309
.. method:: dump_stats(filename)
303310

304311
Write the results of the current profile to *filename*.

Doc/library/sys.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,8 @@ always available.
12021202
Return :const:`True` if the main Python interpreter is
12031203
:term:`shutting down <interpreter shutdown>`. Return :const:`False` otherwise.
12041204

1205+
See also the :exc:`PythonFinalizationError` exception.
1206+
12051207
.. versionadded:: 3.5
12061208

12071209
.. data:: last_exc

0 commit comments

Comments
 (0)
0