]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109740: Use 't' in `--disable-gil` SOABI (#109922)
authorSam Gross <colesbury@gmail.com>
Wed, 27 Sep 2023 15:24:12 +0000 (11:24 -0400)
committerGitHub <noreply@github.com>
Wed, 27 Sep 2023 15:24:12 +0000 (15:24 +0000)
Shared libraries for CPython 3.13 are now marked with a 't' for
threading. For example, `binascii.cpython-313t-darwin.so`.

Doc/library/sys.rst
Lib/test/test_sys.py
Misc/NEWS.d/next/Build/2023-09-26-16-00-50.gh-issue-109740.wboWdQ.rst [new file with mode: 0644]
Python/dynload_win.c
configure
configure.ac

index ef818a7da016dea861ffe71c6152ba99d4c3b6f2..f9f556306f5827517c5320ab28af7f8ec45c02e0 100644 (file)
@@ -22,6 +22,8 @@ always available.
 
    .. versionadded:: 3.2
 
+   .. availability:: Unix.
+
 
 .. function:: addaudithook(hook)
 
index c616a27364b494ab84736c4c3f3f51526226b4aa..16050171ad139d352a1cf07b5dbee04d0bf3d4d5 100644 (file)
@@ -1210,6 +1210,13 @@ class SysModuleTest(unittest.TestCase):
         sys._stats_clear()
         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
 class UnraisableHookTest(unittest.TestCase):
diff --git a/Misc/NEWS.d/next/Build/2023-09-26-16-00-50.gh-issue-109740.wboWdQ.rst b/Misc/NEWS.d/next/Build/2023-09-26-16-00-50.gh-issue-109740.wboWdQ.rst
new file mode 100644 (file)
index 0000000..f59f462
--- /dev/null
@@ -0,0 +1,2 @@
+The experimental ``--disable-gil`` configure flag now includes "t" (for "threaded") in
+extension ABI tags.
index f69995b8f9e3a12fcddcff5d7b522efa2018a327..fcb3cb744047ce3dc651cf5c88732c96073704ad 100644 (file)
 #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"
index abae542b528a23a9cd5b14fba19e5c91e5495e62..098def9aab08bf64393ea404c3ec4372158cb819 100755 (executable)
--- a/configure
+++ b/configure
@@ -1065,6 +1065,7 @@ with_suffix
 enable_shared
 with_static_libpython
 enable_profiling
+enable_gil
 with_pydebug
 with_trace_refs
 enable_pystats
@@ -1105,7 +1106,6 @@ with_openssl_rpath
 with_ssl_default_suites
 with_builtin_hashlib_hashes
 enable_test_modules
-enable_gil
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1792,6 +1792,8 @@ Optional Features:
                           no)
   --enable-profiling      enable C-level code profiling with gprof (default is
                           no)
+  --disable-gil           enable experimental support for running without the
+                          GIL (default is no)
   --enable-pystats        enable internal statistics gathering (default is no)
   --enable-optimizations  enable expensive, stable optimizations (PGO, etc.)
                           (default is no)
@@ -1806,8 +1808,6 @@ Optional Features:
                           use big digits (30 or 15 bits) for Python longs
                           (default is 30)]
   --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:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -7845,6 +7845,36 @@ fi
 
 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
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-pydebug" >&5
 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 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,
 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.
 # On Linux aarch64, GCC may require programs and libraries to be linked
 # explicitly to libatomic. Call _Py_atomic_or_uint64() which may require
index 205a98a992279ca4cf77ae0aa081e1ad11d1099b..3e6cbc69c21009f565773e458c97d6eda7cdbba5 100644 (file)
@@ -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])
+  # Add "t" for "threaded"
+  ABIFLAGS="${ABIFLAGS}t"
+fi
+
 # Check for --with-pydebug
 AC_MSG_CHECKING([for --with-pydebug])
 AC_ARG_WITH([pydebug],
@@ -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,
@@ -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