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()."""
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
}
+#ifndef NDEBUG
static inline int tstate_is_alive(PyThreadState *tstate);
static inline int
{
return tstate->_status.bound && !tstate->_status.unbound;
}
+#endif // !NDEBUG
static void bind_gilstate_tstate(PyThreadState *);
static void unbind_gilstate_tstate(PyThreadState *);
/* the per-thread runtime state */
/********************************/
+#ifndef NDEBUG
static inline int
tstate_is_alive(PyThreadState *tstate)
{
!tstate->_status.cleared &&
!tstate->_status.finalizing);
}
+#endif
//----------