Skip to content

Commit 773614e

Browse files
authored
gh-109740: Use 't' in --disable-gil SOABI (#109922)
Shared libraries for CPython 3.13 are now marked with a 't' for threading. For example, `binascii.cpython-313t-darwin.so`.
1 parent b35f084 commit 773614e

File tree

6 files changed

+71
-48
lines changed

6 files changed

+71
-48
lines changed

Doc/library/sys.rst

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ always available.
2222

2323
.. versionadded:: 3.2
2424

25+
.. availability:: Unix.
26+
2527

2628
.. function:: addaudithook(hook)
2729

Lib/test/test_sys.py

+7
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,13 @@ def test_pystats(self):
12101210
sys._stats_clear()
12111211
sys._stats_dump()
12121212

1213+
@test.support.cpython_only
1214+
@unittest.skipUnless(hasattr(sys, 'abiflags'), 'need sys.abiflags')
1215+
def test_disable_gil_abi(self):
1216+
abi_threaded = 't' in sys.abiflags
1217+
py_nogil = (sysconfig.get_config_var('Py_NOGIL') == 1)
1218+
self.assertEqual(py_nogil, abi_threaded)
1219+
12131220

12141221
@test.support.cpython_only
12151222
class UnraisableHookTest(unittest.TestCase):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The experimental ``--disable-gil`` configure flag now includes "t" (for "threaded") in
2+
extension ABI tags.

Python/dynload_win.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@
1515
#define PYD_DEBUG_SUFFIX ""
1616
#endif
1717

18+
#ifdef Py_NOGIL
19+
# define PYD_THREADING_TAG "t"
20+
#else
21+
# define PYD_THREADING_TAG ""
22+
#endif
23+
1824
#ifdef PYD_PLATFORM_TAG
19-
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd"
25+
#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"
2026
#else
21-
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) ".pyd"
27+
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) PYD_THREADING_TAG ".pyd"
2228
#endif
2329

2430
#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"

configure

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

configure.ac

+18-15
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,23 @@ fi
14891489
AC_SUBST([ABIFLAGS])
14901490
ABIFLAGS=""
14911491

1492+
# Check for --disable-gil
1493+
# --disable-gil
1494+
AC_MSG_CHECKING([for --disable-gil])
1495+
AC_ARG_ENABLE([gil],
1496+
[AS_HELP_STRING([--disable-gil], [enable experimental support for running without the GIL (default is no)])],
1497+
[AS_VAR_IF([enable_gil], [yes], [disable_gil=no], [disable_gil=yes])], [disable_gil=no]
1498+
)
1499+
AC_MSG_RESULT([$disable_gil])
1500+
1501+
if test "$disable_gil" = "yes"
1502+
then
1503+
AC_DEFINE([Py_NOGIL], [1],
1504+
[Define if you want to disable the GIL])
1505+
# Add "t" for "threaded"
1506+
ABIFLAGS="${ABIFLAGS}t"
1507+
fi
1508+
14921509
# Check for --with-pydebug
14931510
AC_MSG_CHECKING([for --with-pydebug])
14941511
AC_ARG_WITH([pydebug],
@@ -5669,6 +5686,7 @@ AC_C_BIGENDIAN
56695686
#
56705687
# * The Python implementation (always 'cpython-' for us)
56715688
# * The major and minor version numbers
5689+
# * --disable-gil (adds a 't')
56725690
# * --with-pydebug (adds a 'd')
56735691
#
56745692
# Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc,
@@ -6947,21 +6965,6 @@ AC_ARG_ENABLE([test-modules],
69476965
AC_MSG_RESULT([$TEST_MODULES])
69486966
AC_SUBST([TEST_MODULES])
69496967

6950-
# Check for --disable-gil
6951-
# --disable-gil
6952-
AC_MSG_CHECKING([for --disable-gil])
6953-
AC_ARG_ENABLE([gil],
6954-
[AS_HELP_STRING([--disable-gil], [enable experimental support for running without the GIL (default is no)])],
6955-
[AS_VAR_IF([enable_gil], [yes], [disable_gil=no], [disable_gil=yes])], [disable_gil=no]
6956-
)
6957-
AC_MSG_RESULT([$disable_gil])
6958-
6959-
if test "$disable_gil" = "yes"
6960-
then
6961-
AC_DEFINE([Py_NOGIL], [1],
6962-
[Define if you want to disable the GIL])
6963-
fi
6964-
69656968
# gh-109054: Check if -latomic is needed to get <pyatomic.h> atomic functions.
69666969
# On Linux aarch64, GCC may require programs and libraries to be linked
69676970
# explicitly to libatomic. Call _Py_atomic_or_uint64() which may require

0 commit comments

Comments
 (0)