Skip to content

Commit faff4de

Browse files
authored
Merge branch 'main' into document-0padding-for-strings/131915
2 parents 9d8532c + af930c1 commit faff4de

14 files changed

Lines changed: 48 additions & 70 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/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:

Lib/test/test_argparse.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7364,6 +7364,9 @@ def test_module_as_main_without_altering_argv(self):
73647364
basename = 'module' + os_helper.FS_NONASCII
73657365
modulename = f'{self.dirname}.{basename}'
73667366
self.make_script(self.dirname, basename)
7367+
# The filesystem encoding may be non-UTF-8,
7368+
# but the runner runs in UTF-8 mode
7369+
modulename = os.fsencode(modulename).decode("utf-8", "surrogateescape")
73677370
runner_source = textwrap.dedent(f'''\
73687371
import runpy
73697372
runpy._run_module_as_main({modulename!r}, alter_argv=False)

0 commit comments

Comments
 (0)