Skip to content

Commit

Permalink
gh-101758: Fix the wasm Buildbots (gh-101943)
Browse files Browse the repository at this point in the history
They were broken by gh-101920.

#101758
  • Loading branch information
ericsnowcurrently authored Feb 16, 2023
1 parent b365d88 commit 3dea4ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Lib/test/test_imp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@
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()."""
Expand Down Expand Up @@ -254,6 +263,7 @@ def test_issue16421_multiple_modules_in_one_dll(self):
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
Expand Down
4 changes: 4 additions & 0 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,15 @@ gilstate_tss_clear(_PyRuntimeState *runtime)
}


#ifndef NDEBUG
static inline int tstate_is_alive(PyThreadState *tstate);

static inline int
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 *);
Expand Down Expand Up @@ -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)
{
Expand All @@ -1127,6 +1130,7 @@ tstate_is_alive(PyThreadState *tstate)
!tstate->_status.cleared &&
!tstate->_status.finalizing);
}
#endif


//----------
Expand Down

0 comments on commit 3dea4ba

Please sign in to comment.