8000 gh-85283: Build fcntl extension with the limited C API (#116791) · python/cpython@97b80af · GitHub
[go: up one dir, main page]

Skip to content

Commit 97b80af

Browse files
authored
gh-85283: Build fcntl extension with the limited C API (#116791)
1 parent f20dfb7 commit 97b80af

File tree

4 files changed

+48
-26
lines changed

4 files changed

+48
-26
lines changed

Doc/whatsnew/3.13.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,8 @@ Build Changes
14601460
* Building CPython now requires a compiler with support for the C11 atomic
14611461
library, GCC built-in atomic functions, or MSVC interlocked intrinsics.
14621462

1463-
* The ``errno``, ``md5``, ``resource``, ``winsound``, ``_ctypes_test``,
1464-
``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
1463+
* The ``errno``, ``fcntl``, ``grp``, ``md5``, ``resource``, ``winsound``,
1464+
``_ctypes_test``, ``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
14651465
``_testimportmultiple`` and ``_uuid`` C extensions are now built with the
14661466
:ref:`limited C API <limited-c-api>`.
14671467
(Contributed by Victor Stinner in :gh:`85283`.)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The ``fcntl`` and ``grp`` C extensions are now built with the :ref:`limited
2+
C API <limited-c-api>`. (Contributed by Victor Stinner in :gh:`85283`.)

Modules/clinic/fcntlmodule.c.h

Lines changed: 33 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/fcntlmodule.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
/* fcntl module */
22

3-
#ifndef Py_BUILD_CORE_BUILTIN
4-
# define Py_BUILD_CORE_MODULE 1
3+
// Need limited C API version 3.13 for PyLong_AsInt()
4+
#include "pyconfig.h" // Py_GIL_DISABLED
5+
#ifndef Py_GIL_DISABLED
6+
# define Py_LIMITED_API 0x030d0000
57
#endif
68

79
#include "Python.h"
810

11+
#include <errno.h> // EINTR
12+
#include <fcntl.h> // fcntl()
13+
#include <string.h> // memcpy()
14+
#include <sys/ioctl.h> // ioctl()
915
#ifdef HAVE_SYS_FILE_H
10-
#include <sys/file.h>
16+
# include <sys/file.h> // flock()
1117
#endif
1218
#ifdef HAVE_LINUX_FS_H
13-
#include <linux/fs.h>
19+
# include <linux/fs.h>
1420
#endif
15-
16-
#include <sys/ioctl.h>
17-
#include <fcntl.h>
1821
#ifdef HAVE_STROPTS_H
19-
#include <stropts.h>
22+
# include <stropts.h> // I_FLUSHBAND
2023
#endif
2124

2225
/*[clinic input]

0 commit comments

Comments
 (0)
0