gh-101758: Fix the wasm Buildbots (gh-101943)

They were broken by gh-101920.

https://github.com/python/cpython/issues/101758
This commit is contained in:
Eric Snow 2023-02-15 17:54:05 -07:00 committed by GitHub
parent b365d88465
commit 3dea4ba6c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -16,12 +16,21 @@ import warnings
imp = warnings_helper.import_deprecated('imp') imp = warnings_helper.import_deprecated('imp')
import _imp import _imp
import _testinternalcapi import _testinternalcapi
import _xxsubinterpreters as _interpreters try:
import _xxsubinterpreters as _interpreters
except ModuleNotFoundError:
_interpreters = None
OS_PATH_NAME = os.path.__name__ 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): def requires_load_dynamic(meth):
"""Decorator to skip a test if not running under CPython or lacking """Decorator to skip a test if not running under CPython or lacking
imp.load_dynamic().""" imp.load_dynamic()."""
@ -254,6 +263,7 @@ class ImportTests(unittest.TestCase):
with self.assertRaises(ImportError): with self.assertRaises(ImportError):
imp.load_dynamic('nonexistent', pathname) imp.load_dynamic('nonexistent', pathname)
@requires_subinterpreters
@requires_load_dynamic @requires_load_dynamic
def test_singlephase_multiple_interpreters(self): def test_singlephase_multiple_interpreters(self):
# Currently, for every single-phrase init module loaded # Currently, for every single-phrase init module loaded

View File

@ -197,6 +197,7 @@ gilstate_tss_clear(_PyRuntimeState *runtime)
} }
#ifndef NDEBUG
static inline int tstate_is_alive(PyThreadState *tstate); static inline int tstate_is_alive(PyThreadState *tstate);
static inline int static inline int
@ -204,6 +205,7 @@ tstate_is_bound(PyThreadState *tstate)
{ {
return tstate->_status.bound && !tstate->_status.unbound; return tstate->_status.bound && !tstate->_status.unbound;
} }
#endif // !NDEBUG
static void bind_gilstate_tstate(PyThreadState *); static void bind_gilstate_tstate(PyThreadState *);
static void unbind_gilstate_tstate(PyThreadState *); static void unbind_gilstate_tstate(PyThreadState *);
@ -1119,6 +1121,7 @@ _PyInterpreterState_LookUpID(int64_t requested_id)
/* the per-thread runtime state */ /* the per-thread runtime state */
/********************************/ /********************************/
#ifndef NDEBUG
static inline int static inline int
tstate_is_alive(PyThreadState *tstate) tstate_is_alive(PyThreadState *tstate)
{ {
@ -1127,6 +1130,7 @@ tstate_is_alive(PyThreadState *tstate)
!tstate->_status.cleared && !tstate->_status.cleared &&
!tstate->_status.finalizing); !tstate->_status.finalizing);
} }
#endif
//---------- //----------