Skip to content

Commit 93c50ec

Browse files
committed
Merge remote-tracking branch 'upstream/main' into minrun
2 parents 94f34f8 + a4625d5 commit 93c50ec

File tree

138 files changed

+2460
-1429
lines changed

Some content is hidden

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

138 files changed

+2460
-1429
lines changed

Doc/c-api/arg.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,12 @@ Building values
686686
``p`` (:class:`bool`) [int]
687687
Convert a C :c:expr:`int` to a Python :class:`bool` object.
688688
689+
Be aware that this format requires an ``int`` argument.
690+
Unlike most other contexts in C, variadic arguments are not coerced to
691+
a suitable type automatically.
692+
You can convert another type (for example, a pointer or a float) to a
693+
suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``.
694+
689695
.. versionadded:: 3.14
690696
691697
``c`` (:class:`bytes` of length 1) [char]

Doc/c-api/exceptions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,16 @@ Exception Classes
749749
.. versionadded:: 3.2
750750
751751
752+
.. c:function:: int PyExceptionClass_Check(PyObject *ob)
753+
754+
Return non-zero if *ob* is an exception class, zero otherwise. This function always succeeds.
755+
756+
757+
.. c:function:: const char *PyExceptionClass_Name(PyObject *ob)
758+
759+
Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*.
760+
761+
752762
Exception Objects
753763
=================
754764

Doc/c-api/extension-modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ in the following ways:
242242
* Single-phase modules support module lookup functions like
243243
:c:func:`PyState_FindModule`.
244244

245-
.. [#testsinglephase] ``_testsinglephase`` is an internal module used \
246-
in CPython's self-test suite; your installation may or may not \
245+
.. [#testsinglephase] ``_testsinglephase`` is an internal module used
246+
in CPython's self-test suite; your installation may or may not
247247
include it.

Doc/c-api/function.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ There are a few functions specific to Python functions.
9595
9696
.. versionadded:: 3.12
9797
98+
99+
.. c:function:: PyObject* PyFunction_GetKwDefaults(PyObject *op)
100+
101+
Return the keyword-only argument default values of the function object *op*. This can be a
102+
dictionary of arguments or ``NULL``.
103+
104+
98105
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
99106
100107
Return the closure associated with the function object *op*. This can be ``NULL``
@@ -123,6 +130,19 @@ There are a few functions specific to Python functions.
123130
Raises :exc:`SystemError` and returns ``-1`` on failure.
124131
125132
133+
.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op)
134+
PyObject *PyFunction_GET_GLOBALS(PyObject *op)
135+
PyObject *PyFunction_GET_MODULE(PyObject *op)
136+
PyObject *PyFunction_GET_DEFAULTS(PyObject *op)
137+
PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op)
138+
PyObject *PyFunction_GET_CLOSURE(PyObject *op)
139+
PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op)
140+
141+
These functions are similar to their ``PyFunction_Get*`` counterparts, but
142+
do not do type checking. Passing anything other than an instance of
143+
:c:data:`PyFunction_Type` is undefined behavior.
144+
145+
126146
.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)
127147
128148
Register *callback* as a function watcher for the current interpreter.

Doc/data/refcounts.dat

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,21 +963,45 @@ PyFunction_Check:PyObject*:o:0:
963963
PyFunction_GetAnnotations:PyObject*::0:
964964
PyFunction_GetAnnotations:PyObject*:op:0:
965965

966+
PyFunction_GET_ANNOTATIONS:PyObject*::0:
967+
PyFunction_GET_ANNOTATIONS:PyObject*:op:0:
968+
966969
PyFunction_GetClosure:PyObject*::0:
967970
PyFunction_GetClosure:PyObject*:op:0:
968971

972+
PyFunction_GET_CLOSURE:PyObject*::0:
973+
PyFunction_GET_CLOSURE:PyObject*:op:0:
974+
969975
PyFunction_GetCode:PyObject*::0:
970976
PyFunction_GetCode:PyObject*:op:0:
971977

978+
PyFunction_GET_CODE:PyObject*::0:
979+
PyFunction_GET_CODE:PyObject*:op:0:
980+
972981
PyFunction_GetDefaults:PyObject*::0:
973982
PyFunction_GetDefaults:PyObject*:op:0:
974983

984+
PyFunction_GET_DEFAULTS:PyObject*::0:
985+
PyFunction_GET_DEFAULTS:PyObject*:op:0:
986+
987+
PyFunction_GetKwDefaults:PyObject*::0:
988+
PyFunction_GetKwDefaults:PyObject*:op:0:
989+
990+
PyFunction_GET_KW_DEFAULTS:PyObject*::0:
991+
PyFunction_GET_KW_DEFAULTS:PyObject*:op:0:
992+
975993
PyFunction_GetGlobals:PyObject*::0:
976994
PyFunction_GetGlobals:PyObject*:op:0:
977995

996+
PyFunction_GET_GLOBALS:PyObject*::0:
997+
PyFunction_GET_GLOBALS:PyObject*:op:0:
998+
978999
PyFunction_GetModule:PyObject*::0:
9791000
PyFunction_GetModule:PyObject*:op:0:
9801001

1002+
PyFunction_GET_MODULE:PyObject*::0:
1003+
PyFunction_GET_MODULE:PyObject*:op:0:
1004+
9811005
PyFunction_New:PyObject*::+1:
9821006
PyFunction_New:PyObject*:code:+1:
9831007
PyFunction_New:PyObject*:globals:+1:

Doc/howto/functional.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ generators:
602602
raise an exception inside the generator; the exception is raised by the
603603
``yield`` expression where the generator's execution is paused.
604604

605-
* :meth:`~generator.close` raises a :exc:`GeneratorExit` exception inside the
605+
* :meth:`~generator.close` sends a :exc:`GeneratorExit` exception to the
606606
generator to terminate the iteration. On receiving this exception, the
607607
generator's code must either raise :exc:`GeneratorExit` or
608608
:exc:`StopIteration`; catching the exception and doing anything else is

Doc/howto/isolating-extensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ Avoiding ``PyObject_New``
453453

454454
GC-tracked objects need to be allocated using GC-aware functions.
455455

456-
If you use use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:
456+
If you use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:
457457

458458
- Get and call type's :c:member:`~PyTypeObject.tp_alloc` slot, if possible.
459459
That is, replace ``TYPE *o = PyObject_New(TYPE, typeobj)`` with::

Doc/library/argparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ See also :ref:`specifying-ambiguous-arguments`. The supported values are:
955955

956956
.. index:: single: + (plus); in argparse module
957957

958-
* ``'+'``. Just like ``'*'``, all command-line args present are gathered into a
958+
* ``'+'``. Just like ``'*'``, all command-line arguments present are gathered into a
959959
list. Additionally, an error message will be generated if there wasn't at
960960
least one command-line argument present. For example::
961961

Doc/library/dialog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ is the base class for dialogs defined in other supporting modules.
220220

221221
.. class:: Dialog(master=None, **options)
222222

223-
.. method:: show(color=None, **options)
223+
.. method:: show(**options)
224224

225225
Render the Dialog window.
226226

Doc/library/functions.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,15 +1839,15 @@ are always available. They are listed here in alphabetical order.
18391839
``range(start, stop, step)``. The *start* and *step* arguments default to
18401840
``None``.
18411841

1842+
Slice objects have read-only data attributes :attr:`!start`,
1843+
:attr:`!stop`, and :attr:`!step` which merely return the argument
1844+
values (or their default). They have no other explicit functionality;
1845+
however, they are used by NumPy and other third-party packages.
1846+
18421847
.. attribute:: slice.start
18431848
.. attribute:: slice.stop
18441849
.. attribute:: slice.step
18451850

1846-
Slice objects have read-only data attributes :attr:`!start`,
1847-
:attr:`!stop`, and :attr:`!step` which merely return the argument
1848-
values (or their default). They have no other explicit functionality;
1849-
however, they are used by NumPy and other third-party packages.
1850-
18511851
Slice objects are also generated when extended indexing syntax is used. For
18521852
example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See
18531853
:func:`itertools.islice` for an alternate version that returns an

0 commit comments

Comments
 (0)