Skip to content

Commit 3dea4ba

Browse files
gh-101758: Fix the wasm Buildbots (gh-101943)
They were broken by gh-101920. #101758
1 parent b365d88 commit 3dea4ba

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Lib/test/test_imp.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,21 @@
1616
imp = warnings_helper.import_deprecated('imp')
1717
import _imp
1818
import _testinternalcapi
19-
import _xxsubinterpreters as _interpreters
19+
try:
20+
import _xxsubinterpreters as _interpreters
21+
except ModuleNotFoundError:
22+
_interpreters = None
2023

2124

2225
OS_PATH_NAME = os.path.__name__
2326

2427

28+
def requires_subinterpreters(meth):
29+
"""Decorator to skip a test if subinterpreters are not supported."""
30+
return unittest.skipIf(_interpreters is None,
31+
'subinterpreters required')(meth)
32+
33+
2534
def requires_load_dynamic(meth):
2635
"""Decorator to skip a test if not running under CPython or lacking
2736
imp.load_dynamic()."""
@@ -254,6 +263,7 @@ def test_issue16421_multiple_modules_in_one_dll(self):
254263
with self.assertRaises(ImportError):
255264
imp.load_dynamic('nonexistent', pathname)
256265

266+
@requires_subinterpreters
257267
@requires_load_dynamic
258268
def test_singlephase_multiple_interpreters(self):
259269
# Currently, for every single-phrase init module loaded

Python/pystate.c

+4
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,15 @@ gilstate_tss_clear(_PyRuntimeState *runtime)
197197
}
198198

199199

200+
#ifndef NDEBUG
200201
static inline int tstate_is_alive(PyThreadState *tstate);
201202

202203
static inline int
203204
tstate_is_bound(PyThreadState *tstate)
204205
{
205206
return tstate->_status.bound && !tstate->_status.unbound;
206207
}
208+
#endif // !NDEBUG
207209

208210
static void bind_gilstate_tstate(PyThreadState *);
209211
static void unbind_gilstate_tstate(PyThreadState *);
@@ -1119,6 +1121,7 @@ _PyInterpreterState_LookUpID(int64_t requested_id)
11191121
/* the per-thread runtime state */
11201122
/********************************/
11211123

1124+
#ifndef NDEBUG
11221125
static inline int
11231126
tstate_is_alive(PyThreadState *tstate)
11241127
{
@@ -1127,6 +1130,7 @@ tstate_is_alive(PyThreadState *tstate)
11271130
!tstate->_status.cleared &&
11281131
!tstate->_status.finalizing);
11291132
}
1133+
#endif
11301134

11311135

11321136
//----------

0 commit comments

Comments
 (0)