Skip to content

Commit 5d1d9b5

Browse files
Merge branch 'main' into interppool
2 parents 3143552 + f41e9c7 commit 5d1d9b5

File tree

259 files changed

+5623
-3187
lines changed

Some content is hidden

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

259 files changed

+5623
-3187
lines changed

.github/workflows/posix-deps-apt.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ apt-get -yq install \
2525
uuid-dev \
2626
xvfb \
2727
zlib1g-dev
28+
29+
# Workaround missing libmpdec-dev on ubuntu 24.04:
30+
# https://launchpad.net/~ondrej/+archive/ubuntu/php
31+
# https://deb.sury.org/
32+
sudo add-apt-repository ppa:ondrej/php
33+
apt-get update
34+
apt-get -yq install libmpdec-dev

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ repos:
3434
name: Run Black on Tools/jit/
3535
files: ^Tools/jit/
3636

37+
- repo: https://github.com/Lucas-C/pre-commit-hooks
38+
rev: v1.5.5
39+
hooks:
40+
- id: remove-tabs
41+
types: [python]
42+
exclude: ^Tools/c-analyzer/cpython/_parser.py
43+
3744
- repo: https://github.com/pre-commit/pre-commit-hooks
3845
rev: v5.0.0
3946
hooks:

Doc/c-api/capsule.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,19 @@ Refer to :ref:`using-capsules` for more information on using these objects.
105105
``module.attribute``. The *name* stored in the capsule must match this
106106
string exactly.
107107
108+
This function splits *name* on the ``.`` character, and imports the first
109+
element. It then processes further elements using attribute lookups.
110+
108111
Return the capsule's internal *pointer* on success. On failure, set an
109112
exception and return ``NULL``.
110113
114+
.. note::
115+
116+
If *name* points to an attribute of some submodule or subpackage, this
117+
submodule or subpackage must be previously imported using other means
118+
(for example, by using :c:func:`PyImport_ImportModule`) for the
119+
attribute lookups to succeed.
120+
111121
.. versionchanged:: 3.3
112122
*no_block* has no effect anymore.
113123

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/c-api/init.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
12501250
.. c:function:: void PyInterpreterState_Clear(PyInterpreterState *interp)
12511251
12521252
Reset all information in an interpreter state object. There must be
1253-
an :term:`attached thread state` for the the interpreter.
1253+
an :term:`attached thread state` for the interpreter.
12541254
12551255
.. audit-event:: cpython.PyInterpreterState_Clear "" c.PyInterpreterState_Clear
12561256
@@ -2277,6 +2277,18 @@ The C-API provides a basic mutual exclusion lock.
22772277
22782278
.. versionadded:: 3.13
22792279
2280+
.. c:function:: int PyMutex_IsLocked(PyMutex *m)
2281+
2282+
Returns non-zero if the mutex *m* is currently locked, zero otherwise.
2283+
2284+
.. note::
2285+
2286+
This function is intended for use in assertions and debugging only and
2287+
should not be used to make concurrency control decisions, as the lock
2288+
state may change immediately after the check.
2289+
2290+
.. versionadded:: next
2291+
22802292
.. _python-critical-section-api:
22812293
22822294
Python Critical Section API

Doc/c-api/long.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
439439
All *n_bytes* of the buffer are written: large buffers are padded with
440440
zeroes.
441441
442-
If the returned value is greater than than *n_bytes*, the value was
442+
If the returned value is greater than *n_bytes*, the value was
443443
truncated: as many of the lowest bits of the value as could fit are written,
444444
and the higher bits are ignored. This matches the typical behavior
445445
of a C-style downcast.

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/deprecations/pending-removal-in-3.15.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Pending removal in Python 3.15
9797
After eight years in the :mod:`typing` module,
9898
it has yet to be supported by any major type checker.
9999

100+
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
101+
100102
* :mod:`wave`:
101103

102104
* The ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ although there is currently no date scheduled for their removal.
8989
underscore.
9090
(Contributed by Serhiy Storchaka in :gh:`91760`.)
9191

92-
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
93-
9492
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
9593
Python 3.12; use the *onexc* parameter instead.
9694

Doc/extending/newtypes_tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ be an instance of a subclass.
277277
The explicit cast to ``CustomObject *`` above is needed because we defined
278278
``Custom_dealloc`` to take a ``PyObject *`` argument, as the ``tp_dealloc``
279279
function pointer expects to receive a ``PyObject *`` argument.
280-
By assigning to the the ``tp_dealloc`` slot of a type, we declare
280+
By assigning to the ``tp_dealloc`` slot of a type, we declare
281281
that it can only be called with instances of our ``CustomObject``
282282
class, so the cast to ``(CustomObject *)`` is safe.
283283
This is object-oriented polymorphism, in C!

0 commit comments

Comments
 (0)