Skip to content

gh-101758: Fix the wasm Builtbots #101943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Lib/test/test_imp.py
Original file line number Diff line number Diff line change
@@ -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()."""
@@ -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
4 changes: 4 additions & 0 deletions Python/pystate.c
Original file line number Diff line number Diff line change
@@ -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 *);
@@ -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


//----------