Skip to content

Commit

Permalink
gh-85283: Build _statistics extension with the limited C API (#116927)
Browse files Browse the repository at this point in the history
Argument Clinic now inlines _PyArg_CheckPositional() for the limited
C API. The generated code should be as fast or even a little bit
faster.
  • Loading branch information
vstinner committed Mar 17, 2024
1 parent 0634201 commit 2982bdb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 37 deletions.
3 changes: 2 additions & 1 deletion Doc/whatsnew/3.13.rst
Expand Up @@ -1482,7 +1482,8 @@ Build Changes
* The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``,
``termios``, ``winsound``,
``_ctypes_test``, ``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
``_testimportmultiple`` and ``_uuid`` C extensions are now built with the
``_statistics``, ``_testimportmultiple`` and ``_uuid``
C extensions are now built with the
:ref:`limited C API <limited-c-api>`.
(Contributed by Victor Stinner in :gh:`85283`.)

Expand Down
@@ -1,2 +1,2 @@
The ``fcntl``, ``grp``, ``pwd`` and ``termios`` C extensions are now
The ``fcntl``, ``grp``, ``pwd``, ``termios`` and ``_statistics`` C extensions are now
built with the :ref:`limited C API <limited-c-api>`. Patch by Victor Stinner.
7 changes: 4 additions & 3 deletions Modules/_statisticsmodule.c
@@ -1,8 +1,9 @@
/* statistics accelerator C extension: _statistics module. */

// clinic/_statisticsmodule.c.h uses internal pycore_modsupport.h API
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000
#endif

#include "Python.h"
Expand Down
45 changes: 13 additions & 32 deletions Modules/clinic/_statisticsmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2982bdb

Please sign in to comment.