Skip to content

Commit 6dd9926

Browse files
authored
Merge branch 'main' into issue-84783
2 parents 12c2488 + 498598e commit 6dd9926

30 files changed

Lines changed: 691 additions & 396 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.github/** @ezio-melotti
99

1010
# Build system
11-
configure* @erlend-aasland
11+
configure* @erlend-aasland @corona10
1212

1313
# asyncio
1414
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303

Doc/c-api/long.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
9494
ignored. If there are no digits or *str* is not NULL-terminated following the
9595
digits and trailing whitespace, :exc:`ValueError` will be raised.
9696
97+
.. seealso:: Python methods :meth:`int.to_bytes` and :meth:`int.from_bytes`
98+
to convert a :c:type:`PyLongObject` to/from an array of bytes in base
99+
``256``. You can call those from C using :c:func:`PyObject_CallMethod`.
100+
97101
98102
.. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base)
99103

Doc/library/dis.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,10 @@ iterations of the loop.
700700
Yields ``STACK.pop()`` from a :term:`generator`.
701701

702702
.. versionchanged:: 3.11
703-
oparg set to be the stack depth, for efficient handling on frames.
703+
oparg set to be the stack depth.
704+
705+
.. versionchanged:: 3.12
706+
oparg set to be the exception block depth, for efficient closing of generators.
704707

705708

706709
.. opcode:: SETUP_ANNOTATIONS

Doc/whatsnew/3.12.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ Deprecated
430430
Before, the Python implementation emitted :exc:`FutureWarning`, and the C
431431
implementation emitted nothing.
432432

433+
* In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:`PyDictObject`
434+
is deprecated for extension modules. Accessing this field will generate a compiler
435+
warning at compile time. This field will be removed in Python 3.14.
436+
(Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. PEP by Ken Jin.)
437+
433438

434439
Pending Removal in Python 3.13
435440
------------------------------

Include/cpython/dictobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ typedef struct {
1616

1717
/* Dictionary version: globally unique, value change each time
1818
the dictionary is modified */
19+
#ifdef Py_BUILD_CORE
1920
uint64_t ma_version_tag;
21+
#else
22+
Py_DEPRECATED(3.12) uint64_t ma_version_tag;
23+
#endif
2024

2125
PyDictKeysObject *ma_keys;
2226

Lib/importlib/_bootstrap_external.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ def _write_atomic(path, data, mode=0o666):
429429
# Python 3.12a1 3513 (Add CALL_INTRINSIC_1 instruction, removed STOPITERATION_ERROR, PRINT_EXPR, IMPORT_STAR)
430430
# Python 3.12a1 3514 (Remove ASYNC_GEN_WRAP, LIST_TO_TUPLE, and UNARY_POSITIVE)
431431
# Python 3.12a1 3515 (Embed jump mask in COMPARE_OP oparg)
432-
# Python 3.12a1 3516 (Add COMAPRE_AND_BRANCH instruction)
432+
# Python 3.12a1 3516 (Add COMPARE_AND_BRANCH instruction)
433+
# Python 3.12a1 3517 (Change YIELD_VALUE oparg to exception block depth)
433434

434435
# Python 3.13 will start with 3550
435436

@@ -442,7 +443,7 @@ def _write_atomic(path, data, mode=0o666):
442443
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
443444
# in PC/launcher.c must also be updated.
444445

445-
MAGIC_NUMBER = (3516).to_bytes(2, 'little') + b'\r\n'
446+
MAGIC_NUMBER = (3517).to_bytes(2, 'little') + b'\r\n'
446447

447448
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
448449

Lib/test/test_call.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,16 @@ def c_py_recurse(m):
934934
finally:
935935
sys.setrecursionlimit(depth)
936936

937+
class TestFunctionWithManyArgs(unittest.TestCase):
938+
def test_function_with_many_args(self):
939+
for N in (10, 500, 1000):
940+
with self.subTest(N=N):
941+
args = ",".join([f"a{i}" for i in range(N)])
942+
src = f"def f({args}) : return a{N//2}"
943+
l = {}
944+
exec(src, {}, l)
945+
self.assertEqual(l['f'](*range(N)), N//2)
946+
937947

938948
if __name__ == "__main__":
939949
unittest.main()

Lib/test/test_dis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ async def _asyncwith(c):
492492
GET_AWAITABLE 1
493493
LOAD_CONST 0 (None)
494494
>> SEND 3 (to 22)
495-
YIELD_VALUE 3
495+
YIELD_VALUE 2
496496
RESUME 3
497497
JUMP_BACKWARD_NO_INTERRUPT 4 (to 14)
498498
>> POP_TOP
@@ -526,7 +526,7 @@ async def _asyncwith(c):
526526
GET_AWAITABLE 2
527527
LOAD_CONST 0 (None)
528528
>> SEND 4 (to 92)
529-
YIELD_VALUE 6
529+
YIELD_VALUE 3
530530
RESUME 3
531531
JUMP_BACKWARD_NO_INTERRUPT 4 (to 82)
532532
>> CLEANUP_THROW
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Conditionally add ``-fno-reorder-blocks-and-partition`` in configure.
2+
Effectively fixes ``--enable-bolt`` when using Clang, as this appears to be
3+
a GCC-only flag.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In accordance with :PEP:`699`, the ``ma_version_tag`` field in :c:type:`PyDictObject`
2+
is deprecated for extension modules. Accessing this field will generate a compiler
3+
warning at compile time. This field will be removed in Python 3.14.

0 commit comments

Comments
 (0)