Skip to content

Commit 6f42c11

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-08-07)
Summary: Imported python/cpython `3.16.0a0` from upstream rev [`af930c1`](https://www.github.com/python/cpython/commit/af930c13787a15c22187d5d526f74f35c95f8056) (committed 2026-08-07 04:09:28+00:00). # Commit Info - Base: (`3.16.0a0`) - [`d2f4649`](https://www.github.com/python/cpython/commit/d2f464959287c91dd4365d69ab99022f20e3b64a) (commit date: 2026-08-06 01:59:28+00:00) - Imported: (`3.16.0a0`) - [`af930c1`](https://www.github.com/python/cpython/commit/af930c13787a15c22187d5d526f74f35c95f8056) (commit date: 2026-08-07 04:09:28+00:00) # Noteworthy file changes - Low-signal files (2 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GF7A7CcNf4u7PD4GAKjqPRRX1u9hbr0LAAAz Reviewed By: itamaro Differential Revision: D115155377 fbshipit-source-id: fe8d10872eedd4ace7f28d4270eafe2d8d2d6a22
1 parent 96ac35c commit 6f42c11

21 files changed

Lines changed: 167 additions & 72 deletions

File tree

Doc/c-api/arg.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,18 @@ inside nested parentheses. They are:
399399
their default value --- when an optional argument is not specified,
400400
:c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding C
401401
variable(s).
402+
For example, the format string ``"OO|OO"`` corresponds to the Python
403+
signature ``f(a, b, c=None, d=None)``.
402404

403405
``$``
404406
:c:func:`PyArg_ParseTupleAndKeywords` only:
405407
Indicates that the remaining arguments in the Python argument list are
406-
keyword-only. Currently, all keyword-only arguments must also be optional
407-
arguments, so ``|`` must always be specified before ``$`` in the format
408-
string.
408+
keyword-only.
409+
They are optional if ``|`` was specified before ``$``, and required otherwise.
410+
``|`` cannot be specified after ``$``.
411+
For example, the format string ``"O|O$O"`` corresponds to the Python
412+
signature ``f(a, b=None, *, c=None)``,
413+
and the format string ``"OO$OO"`` corresponds to ``f(a, b, *, c, d)``.
409414

410415
.. versionadded:: 3.3
411416

Doc/c-api/frame.rst

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -243,41 +243,3 @@ Unless using :pep:`523`, you will not need this.
243243
Return the currently executing line number, or -1 if there is no line number.
244244
245245
.. versionadded:: 3.12
246-
247-
248-
.. c:var:: const PyTypeObject *PyUnstable_ExecutableKinds
249-
250-
An array of executable kinds (executor types) for frames, used for internal
251-
debugging and tracing.
252-
253-
Tools like debuggers and profilers can use this to identify the type of execution
254-
context associated with a frame (such as to filter out internal frames).
255-
The entries are indexed by the following constants:
256-
257-
.. list-table::
258-
:header-rows: 1
259-
:widths: auto
260-
261-
* - Constant
262-
- Description
263-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_SKIP
264-
- The frame is internal (For example: inlined) and should be skipped by tools.
265-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_PY_FUNCTION
266-
- The frame corresponds to a standard Python function.
267-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION
268-
- The frame corresponds to a function defined in native code.
269-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR
270-
- The frame corresponds to a method on a class instance.
271-
272-
Note that reading the executable kind from a frame is currently only
273-
possible with undocumented internal APIs.
274-
275-
.. versionadded:: 3.13
276-
277-
278-
.. c:macro:: PyUnstable_EXECUTABLE_KINDS
279-
280-
The number of entries in :c:data:`PyUnstable_ExecutableKinds`.
281-
282-
.. versionadded:: 3.13
283-

Doc/tools/removed-ids.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ using/configure.html: cmdoption-with-system-libmpdec
2323
library/symtable.html: symtable.Class.get_methods
2424
library/sys.html: sys._enablelegacywindowsfsencoding
2525
c-api/import.html: c.PyImport_LazyImportsMode.PyImport_LAZY_NONE
26+
c-api/frame.html: c.PyUnstable_EXECUTABLE_KINDS
27+
c-api/frame.html: c.PyUnstable_ExecutableKinds
28+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION
29+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR
30+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_PY_FUNCTION
31+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_SKIP
32+
2633

2734
## Old names for grammar tokens
2835
reference/expressions.html: grammar-token-python-grammar-comp_for

Doc/tools/templates/indexcontent.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,16 @@ <h1>{{ docstitle|e }}</h1>
8282
<p><strong>{% trans %}Other resources:{% endtrans %}</strong></p>
8383
<div class="contentstable">
8484
<ul>
85+
<li class="biglink"><a class="biglink" href="https://devguide.python.org">{% trans %}Python developer's guide{% endtrans %}</a><br>
86+
<span class="linkdescr">{% trans %}Information on contributing to Python{% endtrans %}</span></li>
8587
<li class="biglink"><a class="biglink" href="https://packaging.python.org">{% trans %}Python Packaging User Guide{% endtrans %}</a><br>
8688
<span class="linkdescr">{% trans %}Resources relating to Python packaging{% endtrans %}</span></li>
89+
<li class="biglink"><a class="biglink" href="https://www.python.org/doc/av/">{% trans %}Audio/visual talks{% endtrans %}</a><br>
90+
<span class="linkdescr">{% trans %}Podcasts, talks, and video presentations from the community{% endtrans %}</span></li>
8791
</ul>
8892
<ul>
93+
<li class="biglink"><a class="biglink" href="https://peps.python.org/">{% trans %}Python Enhancement Proposals{% endtrans %}</a><br>
94+
<span class="linkdescr">{% trans %}Index of proposed improvements to Python{% endtrans %}</span></li>
8995
<li class="biglink"><a class="biglink" href="https://typing.python.org">{% trans %}Static Typing with Python{% endtrans %}</a><br>
9096
<span class="linkdescr">{% trans %}Information and guides about Python type safety{% endtrans %}</span></li>
9197
</ul>

Doc/tools/templates/indexsidebar.html

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,3 @@ <h3>{% trans %}Docs by version{% endtrans %}</h3>
66
{% include "_docs_by_version.html" without context %}
77
<li><a href="https://www.python.org/doc/versions/">{% trans %}All versions{% endtrans %}</a></li>
88
</ul>
9-
<h3>{% trans %}Other resources{% endtrans %}</h3>
10-
<ul>
11-
{# XXX: many of these should probably be merged in the main docs #}
12-
<li><a href="https://peps.python.org/">{% trans %}PEP index{% endtrans %}</a></li>
13-
<li><a href="https://wiki.python.org/moin/BeginnersGuide">{% trans %}Beginner's guide{% endtrans %}</a></li>
14-
<li><a href="https://wiki.python.org/moin/PythonBooks">{% trans %}Book list{% endtrans %}</a></li>
15-
<li><a href="https://www.python.org/doc/av/">{% trans %}Audio/visual talks{% endtrans %}</a></li>
16-
<li><a href="https://devguide.python.org/">{% trans %}Python developer’s guide{% endtrans %}</a></li>
17-
</ul>

Doc/whatsnew/3.16.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,3 +872,12 @@ Deprecated C APIs
872872

873873
Removed C APIs
874874
--------------
875+
876+
* The :c:var:`!PyUnstable_ExecutableKinds` array, as well as the macros
877+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_SKIP`,
878+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_PY_FUNCTION`,
879+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION`,
880+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR` and
881+
:c:macro:`!PyUnstable_EXECUTABLE_KINDS`, were removed.
882+
883+
(Contributed by Peters Bierma and Viktorin in :gh:`152105`.)

Include/cpython/pyframe.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,3 @@ PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame
3535
/* Returns the currently executing line number, or -1 if there is no line number.
3636
* Does not raise an exception. */
3737
PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);
38-
39-
#define PyUnstable_EXECUTABLE_KIND_SKIP 0
40-
#define PyUnstable_EXECUTABLE_KIND_PY_FUNCTION 1
41-
#define PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION 3
42-
#define PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR 4
43-
#define PyUnstable_EXECUTABLE_KINDS 5
44-
45-
PyAPI_DATA(const PyTypeObject *) const PyUnstable_ExecutableKinds[PyUnstable_EXECUTABLE_KINDS+1];

Lib/_pydecimal.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,9 +1824,10 @@ def __round__(self, n=None):
18241824
Decimal('123.46')
18251825
>>> round(Decimal('123.456'), -2)
18261826
Decimal('1E+2')
1827-
>>> round(Decimal('-Infinity'), 37)
1827+
>>> with localcontext(ExtendedContext):
1828+
... round(Decimal('-Infinity'), 37)
1829+
... round(Decimal('sNaN123'), 0)
18281830
Decimal('NaN')
1829-
>>> round(Decimal('sNaN123'), 0)
18301831
Decimal('NaN123')
18311832
18321833
"""

Lib/test/clinic.test.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5769,6 +5769,56 @@ Test___init___impl(TestObj *self, PyObject *a, int group_right_1,
57695769
/*[clinic end generated code: output=2bbb8ea60e8f57a6 input=10f5d0f1e8e466ef]*/
57705770

57715771

5772+
/*[clinic input]
5773+
only_optional_group
5774+
[
5775+
a: object
5776+
]
5777+
/
5778+
The only parameter is in an optional group.
5779+
[clinic start generated code]*/
5780+
5781+
PyDoc_STRVAR(only_optional_group__doc__,
5782+
"only_optional_group([a])\n"
5783+
"The only parameter is in an optional group.");
5784+
5785+
#define ONLY_OPTIONAL_GROUP_METHODDEF \
5786+
{"only_optional_group", (PyCFunction)only_optional_group, METH_VARARGS, only_optional_group__doc__},
5787+
5788+
static PyObject *
5789+
only_optional_group_impl(PyObject *module, int group_right_1, PyObject *a);
5790+
5791+
static PyObject *
5792+
only_optional_group(PyObject *module, PyObject *args)
5793+
{
5794+
PyObject *return_value = NULL;
5795+
int group_right_1 = 0;
5796+
PyObject *a = NULL;
5797+
5798+
switch (PyTuple_GET_SIZE(args)) {
5799+
case 0:
5800+
break;
5801+
case 1:
5802+
if (!PyArg_ParseTuple(args, "O:only_optional_group", &a)) {
5803+
goto exit;
5804+
}
5805+
group_right_1 = 1;
5806+
break;
5807+
default:
5808+
PyErr_SetString(PyExc_TypeError, "only_optional_group requires 0 to 1 arguments");
5809+
goto exit;
5810+
}
5811+
return_value = only_optional_group_impl(module, group_right_1, a);
5812+
5813+
exit:
5814+
return return_value;
5815+
}
5816+
5817+
static PyObject *
5818+
only_optional_group_impl(PyObject *module, int group_right_1, PyObject *a)
5819+
/*[clinic end generated code: output=e7546b9441793d7d input=426c64055af7bcab]*/
5820+
5821+
57725822
/*[clinic input]
57735823
group_and_optional_parameter
57745824
[

Lib/test/support/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ def bigmemtest(size, memuse, dry_run=True):
12931293
test doesn't support dummy runs when -M is not specified.
12941294
"""
12951295
def decorator(f):
1296+
@functools.wraps(f)
12961297
def wrapper(self):
12971298
size = wrapper.size
12981299
memuse = wrapper.memuse
@@ -1345,6 +1346,7 @@ def internal(*args, **kwargs):
13451346

13461347
def bigaddrspacetest(f):
13471348
"""Decorator for tests that fill the address space."""
1349+
@functools.wraps(f)
13481350
def wrapper(self):
13491351
if max_memuse < MAX_Py_ssize_t:
13501352
if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31:
@@ -1450,6 +1452,7 @@ def no_rerun(reason):
14501452
def deco(func):
14511453
assert not isinstance(func, type), func
14521454
_has_run = False
1455+
@functools.wraps(func)
14531456
def wrapper(self):
14541457
nonlocal _has_run
14551458
if _has_run:

0 commit comments

Comments
 (0)