Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-109740: Use 't' in --disable-gil SOABI #109922

Merged
merged 8 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ always available.

.. versionadded:: 3.2

.. availability:: Unix.


.. function:: addaudithook(hook)

Expand Down
7 changes: 7 additions & 0 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,13 @@ def test_pystats(self):
sys._stats_clear()
sys._stats_dump()

@test.support.cpython_only
@unittest.skipUnless(hasattr(sys, 'abiflags'), 'need sys.abiflags')
vstinner marked this conversation as resolved.
Show resolved Hide resolved
def test_disable_gil_abi(self):
abi_threaded = 't' in sys.abiflags
py_nogil = (sysconfig.get_config_var('Py_NOGIL') == 1)
self.assertEqual(py_nogil, abi_threaded)


@test.support.cpython_only
class UnraisableHookTest(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The experimental ``--disable-gil`` configure flag now includes "t" (for "threaded") in
extension ABI tags.
10 changes: 8 additions & 2 deletions Python/dynload_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
#define PYD_DEBUG_SUFFIX ""
#endif

#ifdef Py_NOGIL
# define PYD_THREADING_TAG "t"
#else
# define PYD_THREADING_TAG ""
#endif

#ifdef PYD_PLATFORM_TAG
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd"
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) PYD_THREADING_TAG "-" PYD_PLATFORM_TAG ".pyd"
#else
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) ".pyd"
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) PYD_THREADING_TAG ".pyd"
#endif

#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"
Expand Down
65 changes: 34 additions & 31 deletions configure

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

33 changes: 18 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,23 @@ fi
AC_SUBST([ABIFLAGS])
ABIFLAGS=""

# Check for --disable-gil
# --disable-gil
AC_MSG_CHECKING([for --disable-gil])
AC_ARG_ENABLE([gil],
[AS_HELP_STRING([--disable-gil], [enable experimental support for running without the GIL (default is no)])],
[AS_VAR_IF([enable_gil], [yes], [disable_gil=no], [disable_gil=yes])], [disable_gil=no]
)
AC_MSG_RESULT([$disable_gil])

if test "$disable_gil" = "yes"
then
AC_DEFINE([Py_NOGIL], [1],
[Define if you want to disable the GIL])
vstinner marked this conversation as resolved.
Show resolved Hide resolved
# Add "t" for "threaded"
ABIFLAGS="${ABIFLAGS}t"
fi

# Check for --with-pydebug
AC_MSG_CHECKING([for --with-pydebug])
AC_ARG_WITH([pydebug],
Expand Down Expand Up @@ -5669,6 +5686,7 @@ AC_C_BIGENDIAN
#
# * The Python implementation (always 'cpython-' for us)
# * The major and minor version numbers
# * --disable-gil (adds a 't')
# * --with-pydebug (adds a 'd')
#
# Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc,
Expand Down Expand Up @@ -6947,21 +6965,6 @@ AC_ARG_ENABLE([test-modules],
AC_MSG_RESULT([$TEST_MODULES])
AC_SUBST([TEST_MODULES])

# Check for --disable-gil
# --disable-gil
AC_MSG_CHECKING([for --disable-gil])
AC_ARG_ENABLE([gil],
[AS_HELP_STRING([--disable-gil], [enable experimental support for running without the GIL (default is no)])],
[AS_VAR_IF([enable_gil], [yes], [disable_gil=no], [disable_gil=yes])], [disable_gil=no]
)
AC_MSG_RESULT([$disable_gil])

if test "$disable_gil" = "yes"
then
AC_DEFINE([Py_NOGIL], [1],
[Define if you want to disable the GIL])
fi

# gh-109054: Check if -latomic is needed to get <pyatomic.h> atomic functions.
# On Linux aarch64, GCC may require programs and libraries to be linked
# explicitly to libatomic. Call _Py_atomic_or_uint64() which may require
Expand Down
Loading