summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-02-16 00:54:05 (GMT)
committerGitHub <noreply@github.com>2023-02-16 00:54:05 (GMT)
commit3dea4ba6c1b9237893d23574f931f33c940b74e8 (patch)
tree7a4afd9349b3a6aeff39b6b642fef76ae1a0aa13
parentb365d88465d9228ce4e9e0be20b88e9e4056ad88 (diff)
downloadcpython-3dea4ba6c1b9237893d23574f931f33c940b74e8.zip
cpython-3dea4ba6c1b9237893d23574f931f33c940b74e8.tar.gz
cpython-3dea4ba6c1b9237893d23574f931f33c940b74e8.tar.bz2
gh-101758: Fix the wasm Buildbots (gh-101943)
They were broken by gh-101920. https://github.com/python/cpython/issues/101758
-rw-r--r--Lib/test/test_imp.py12
-rw-r--r--Python/pystate.c4
2 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index e81eb6f..5997ffa 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -16,12 +16,21 @@ import warnings
imp = warnings_helper.import_deprecated('imp')
import _imp
import _testinternalcapi
-import _xxsubinterpreters as _interpreters
+try:
+ import _xxsubinterpreters as _interpreters
+except ModuleNotFoundError:
+ _interpreters = None
OS_PATH_NAME = os.path.__name__
+def requires_subinterpreters(meth):
+ """Decorator to skip a test if subinterpreters are not supported."""
+ return unittest.skipIf(_interpreters is None,
+ 'subinterpreters required')(meth)
+
+
def requires_load_dynamic(meth):
"""Decorator to skip a test if not running under CPython or lacking
imp.load_dynamic()."""
@@ -254,6 +263,7 @@ class ImportTests(unittest.TestCase):
with self.assertRaises(ImportError):
imp.load_dynamic('nonexistent', pathname)
+ @requires_subinterpreters
@requires_load_dynamic
def test_singlephase_multiple_interpreters(self):
# Currently, for every single-phrase init module loaded
diff --git a/Python/pystate.c b/Python/pystate.c
index 4770caa..32b17fd 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -197,6 +197,7 @@ gilstate_tss_clear(_PyRuntimeState *runtime)
}
+#ifndef NDEBUG
static inline int tstate_is_alive(PyThreadState *tstate);
static inline int
@@ -204,6 +205,7 @@ tstate_is_bound(PyThreadState *tstate)
{
return tstate->_status.bound && !tstate->_status.unbound;
}
+#endif // !NDEBUG
static void bind_gilstate_tstate(PyThreadState *);
static void unbind_gilstate_tstate(PyThreadState *);
@@ -1119,6 +1121,7 @@ _PyInterpreterState_LookUpID(int64_t requested_id)
/* the per-thread runtime state */
/********************************/
+#ifndef NDEBUG
static inline int
tstate_is_alive(PyThreadState *tstate)
{
@@ -1127,6 +1130,7 @@ tstate_is_alive(PyThreadState *tstate)
!tstate->_status.cleared &&
!tstate->_status.finalizing);
}
+#endif
//----------