from pypy.module.thread.test.support import GenericTestThread
+ spaceconfig = dict(usemodules=GenericTestThread.spaceconfig['usemodules'] + ('imp',))
# XXX This test depends on a multicore machine, as busy_thread must
# aquire the GIL the instant that the main thread releases it.
# if 9, process was killed by timer.
# if 42<<8, os._exit(42) was correctly reached.
assert feedback == [42<<8]
+ def test_nested_import_lock_fork(self):
+ """Check fork() in main thread works while the main thread is doing an import"""
+ # Issue 9573: this used to trigger RuntimeError in the child process
+ def fork_with_import_lock(level):
+ for i in range(release):
+ print("RuntimeError in child")
+ spid, status = os.waitpid(pid, os.WNOHANG)
+ # Check this works with various levels of nested
+ # import in the main thread