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`.
This commit is contained in:
Sam Gross 2023-09-27 11:24:12 -04:00 committed by GitHub
parent b35f0843fc
commit 773614e03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 49 deletions

View File

@ -22,6 +22,8 @@ always available.
.. versionadded:: 3.2 .. versionadded:: 3.2
.. availability:: Unix.
.. function:: addaudithook(hook) .. function:: addaudithook(hook)

View File

@ -1210,6 +1210,13 @@ class SysModuleTest(unittest.TestCase):
sys._stats_clear() sys._stats_clear()
sys._stats_dump() sys._stats_dump()
@test.support.cpython_only
@unittest.skipUnless(hasattr(sys, 'abiflags'), 'need sys.abiflags')
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 @test.support.cpython_only
class UnraisableHookTest(unittest.TestCase): class UnraisableHookTest(unittest.TestCase):

View File

@ -0,0 +1,2 @@
The experimental ``--disable-gil`` configure flag now includes "t" (for "threaded") in
extension ABI tags.

View File

@ -15,10 +15,16 @@
#define PYD_DEBUG_SUFFIX "" #define PYD_DEBUG_SUFFIX ""
#endif #endif
#ifdef PYD_PLATFORM_TAG #ifdef Py_NOGIL
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd" # define PYD_THREADING_TAG "t"
#else #else
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) ".pyd" # 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_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_THREADING_TAG ".pyd"
#endif #endif
#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd" #define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"

65
configure generated vendored
View File

@ -1065,6 +1065,7 @@ with_suffix
enable_shared enable_shared
with_static_libpython with_static_libpython
enable_profiling enable_profiling
enable_gil
with_pydebug with_pydebug
with_trace_refs with_trace_refs
enable_pystats enable_pystats
@ -1105,7 +1106,6 @@ with_openssl_rpath
with_ssl_default_suites with_ssl_default_suites
with_builtin_hashlib_hashes with_builtin_hashlib_hashes
enable_test_modules enable_test_modules
enable_gil
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@ -1792,6 +1792,8 @@ Optional Features:
no) no)
--enable-profiling enable C-level code profiling with gprof (default is --enable-profiling enable C-level code profiling with gprof (default is
no) no)
--disable-gil enable experimental support for running without the
GIL (default is no)
--enable-pystats enable internal statistics gathering (default is no) --enable-pystats enable internal statistics gathering (default is no)
--enable-optimizations enable expensive, stable optimizations (PGO, etc.) --enable-optimizations enable expensive, stable optimizations (PGO, etc.)
(default is no) (default is no)
@ -1806,8 +1808,6 @@ Optional Features:
use big digits (30 or 15 bits) for Python longs use big digits (30 or 15 bits) for Python longs
(default is 30)] (default is 30)]
--disable-test-modules don't build nor install test modules --disable-test-modules don't build nor install test modules
--disable-gil enable experimental support for running without the
GIL (default is no)
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -7845,6 +7845,36 @@ fi
ABIFLAGS="" ABIFLAGS=""
# Check for --disable-gil
# --disable-gil
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --disable-gil" >&5
printf %s "checking for --disable-gil... " >&6; }
# Check whether --enable-gil was given.
if test ${enable_gil+y}
then :
enableval=$enable_gil; if test "x$enable_gil" = xyes
then :
disable_gil=no
else $as_nop
disable_gil=yes
fi
else $as_nop
disable_gil=no
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $disable_gil" >&5
printf "%s\n" "$disable_gil" >&6; }
if test "$disable_gil" = "yes"
then
printf "%s\n" "#define Py_NOGIL 1" >>confdefs.h
# Add "t" for "threaded"
ABIFLAGS="${ABIFLAGS}t"
fi
# Check for --with-pydebug # Check for --with-pydebug
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-pydebug" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-pydebug" >&5
printf %s "checking for --with-pydebug... " >&6; } printf %s "checking for --with-pydebug... " >&6; }
@ -23546,6 +23576,7 @@ printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
# #
# * The Python implementation (always 'cpython-' for us) # * The Python implementation (always 'cpython-' for us)
# * The major and minor version numbers # * The major and minor version numbers
# * --disable-gil (adds a 't')
# * --with-pydebug (adds a 'd') # * --with-pydebug (adds a 'd')
# #
# Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc, # Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc,
@ -27724,34 +27755,6 @@ fi
printf "%s\n" "$TEST_MODULES" >&6; } printf "%s\n" "$TEST_MODULES" >&6; }
# Check for --disable-gil
# --disable-gil
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --disable-gil" >&5
printf %s "checking for --disable-gil... " >&6; }
# Check whether --enable-gil was given.
if test ${enable_gil+y}
then :
enableval=$enable_gil; if test "x$enable_gil" = xyes
then :
disable_gil=no
else $as_nop
disable_gil=yes
fi
else $as_nop
disable_gil=no
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $disable_gil" >&5
printf "%s\n" "$disable_gil" >&6; }
if test "$disable_gil" = "yes"
then
printf "%s\n" "#define Py_NOGIL 1" >>confdefs.h
fi
# gh-109054: Check if -latomic is needed to get <pyatomic.h> atomic functions. # 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 # On Linux aarch64, GCC may require programs and libraries to be linked
# explicitly to libatomic. Call _Py_atomic_or_uint64() which may require # explicitly to libatomic. Call _Py_atomic_or_uint64() which may require

View File

@ -1489,6 +1489,23 @@ fi
AC_SUBST([ABIFLAGS]) AC_SUBST([ABIFLAGS])
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])
# Add "t" for "threaded"
ABIFLAGS="${ABIFLAGS}t"
fi
# Check for --with-pydebug # Check for --with-pydebug
AC_MSG_CHECKING([for --with-pydebug]) AC_MSG_CHECKING([for --with-pydebug])
AC_ARG_WITH([pydebug], AC_ARG_WITH([pydebug],
@ -5669,6 +5686,7 @@ AC_C_BIGENDIAN
# #
# * The Python implementation (always 'cpython-' for us) # * The Python implementation (always 'cpython-' for us)
# * The major and minor version numbers # * The major and minor version numbers
# * --disable-gil (adds a 't')
# * --with-pydebug (adds a 'd') # * --with-pydebug (adds a 'd')
# #
# Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc, # Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc,
@ -6947,21 +6965,6 @@ AC_ARG_ENABLE([test-modules],
AC_MSG_RESULT([$TEST_MODULES]) AC_MSG_RESULT([$TEST_MODULES])
AC_SUBST([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. # 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 # On Linux aarch64, GCC may require programs and libraries to be linked
# explicitly to libatomic. Call _Py_atomic_or_uint64() which may require # explicitly to libatomic. Call _Py_atomic_or_uint64() which may require