Skip to content

Commit

Permalink
pythongh-85283: Build fcntl extension with the limited C API (python#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner authored and diegorusso committed Apr 17, 2024
1 parent 2227362 commit 7b31a9a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.13.rst
Expand Up @@ -1460,8 +1460,8 @@ Build Changes
* Building CPython now requires a compiler with support for the C11 atomic
library, GCC built-in atomic functions, or MSVC interlocked intrinsics.

* The ``errno``, ``md5``, ``resource``, ``winsound``, ``_ctypes_test``,
``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
* The ``errno``, ``fcntl``, ``grp``, ``md5``, ``resource``, ``winsound``,
``_ctypes_test``, ``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
``_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
@@ -0,0 +1,2 @@
The ``fcntl`` and ``grp`` C extensions are now built with the :ref:`limited
C API <limited-c-api>`. (Contributed by Victor Stinner in :gh:`85283`.)
49 changes: 33 additions & 16 deletions Modules/clinic/fcntlmodule.c.h

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

19 changes: 11 additions & 8 deletions Modules/fcntlmodule.c
@@ -1,22 +1,25 @@
/* fcntl module */

#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
// Need limited C API version 3.13 for PyLong_AsInt()
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030d0000
#endif

#include "Python.h"

#include <errno.h> // EINTR
#include <fcntl.h> // fcntl()
#include <string.h> // memcpy()
#include <sys/ioctl.h> // ioctl()
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
# include <sys/file.h> // flock()
#endif
#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h>
# include <linux/fs.h>
#endif

#include <sys/ioctl.h>
#include <fcntl.h>
#ifdef HAVE_STROPTS_H
#include <stropts.h>
# include <stropts.h> // I_FLUSHBAND
#endif

/*[clinic input]
Expand Down

0 comments on commit 7b31a9a

Please sign in to comment.