summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_interpreters
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-05-07 04:21:51 (GMT)
committerGitHub <noreply@github.com>2024-05-07 04:21:51 (GMT)
commitb2cd54a4fb2ecdb7b1d30bda8af3314d3a32031e (patch)
tree829360e381eef6107cb2aa836bd7c4d79e77f514 /Lib/test/test_interpreters
parent1a23716d4ba6c6dadd76a3662db580f451f660e3 (diff)
downloadcpython-b2cd54a4fb2ecdb7b1d30bda8af3314d3a32031e.zip
cpython-b2cd54a4fb2ecdb7b1d30bda8af3314d3a32031e.tar.gz
cpython-b2cd54a4fb2ecdb7b1d30bda8af3314d3a32031e.tar.bz2
gh-117953: Always Run Extension Init Func in Main Interpreter First (gh-118157)
This change makes sure all extension/builtin modules have their init function run first by the main interpreter before proceeding with import in the original interpreter (main or otherwise). This means when the import of a single-phase init module fails in an isolated subinterpreter, it won't tie any global state/callbacks to the subinterpreter.
Diffstat (limited to 'Lib/test/test_interpreters')
-rw-r--r--Lib/test/test_interpreters/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_interpreters/__init__.py b/Lib/test/test_interpreters/__init__.py
index 4b16ecc..52ff553 100644
--- a/Lib/test/test_interpreters/__init__.py
+++ b/Lib/test/test_interpreters/__init__.py
@@ -1,5 +1,6 @@
import os
-from test.support import load_package_tests
+from test.support import load_package_tests, Py_GIL_DISABLED
-def load_tests(*args):
- return load_package_tests(os.path.dirname(__file__), *args)
+if not Py_GIL_DISABLED:
+ def load_tests(*args):
+ return load_package_tests(os.path.dirname(__file__), *args)