Skip to content

Commit 2982bdb

Browse files
authored
gh-85283: Build _statistics extension with the limited C API (#116927)
Argument Clinic now inlines _PyArg_CheckPositional() for the limited C API. The generated code should be as fast or even a little bit faster.
1 parent 0634201 commit 2982bdb

File tree

4 files changed

+20
-37
lines changed

4 files changed

+20
-37
lines changed

Doc/whatsnew/3.13.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,8 @@ Build Changes
14821482
* The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``,
14831483
``termios``, ``winsound``,
14841484
``_ctypes_test``, ``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
1485-
``_testimportmultiple`` and ``_uuid`` C extensions are now built with the
1485+
``_statistics``, ``_testimportmultiple`` and ``_uuid``
1486+
C extensions are now built with the
14861487
:ref:`limited C API <limited-c-api>`.
14871488
(Contributed by Victor Stinner in :gh:`85283`.)
14881489

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
The ``fcntl``, ``grp``, ``pwd`` and ``termios`` C extensions are now
1+
The ``fcntl``, ``grp``, ``pwd``, ``termios`` and ``_statistics`` C extensions are now
22
built with the :ref:`limited C API <limited-c-api>`. Patch by Victor Stinner.

Modules/_statisticsmodule.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* statistics accelerator C extension: _statistics module. */
22

3-
// clinic/_statisticsmodule.c.h uses internal pycore_modsupport.h API
4-
#ifndef Py_BUILD_CORE_BUILTIN
5-
# define Py_BUILD_CORE_MODULE 1
3+
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
4+
#include "pyconfig.h" // Py_GIL_DISABLED
5+
#ifndef Py_GIL_DISABLED
6+
# define Py_LIMITED_API 0x030c0000
67
#endif
78

89
#include "Python.h"

Modules/clinic/_statisticsmodule.c.h

+13-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)