mirror of
https://github.com/python/cpython.git
synced 2025-09-05 00:11:10 +00:00
gh-76785: Fixes for test.support.interpreters (gh-112982)
This involves a number of changes for PEP 734.
This commit is contained in:
parent
f26bfe4b25
commit
86a77f4e1a
30 changed files with 2506 additions and 1507 deletions
|
@ -657,14 +657,26 @@ class IncompatibleExtensionModuleRestrictionsTests(unittest.TestCase):
|
|||
|
||||
def run_with_own_gil(self, script):
|
||||
interpid = _interpreters.create(isolated=True)
|
||||
excsnap = _interpreters.run_string(interpid, script)
|
||||
def ensure_destroyed():
|
||||
try:
|
||||
_interpreters.destroy(interpid)
|
||||
except _interpreters.InterpreterNotFoundError:
|
||||
pass
|
||||
self.addCleanup(ensure_destroyed)
|
||||
excsnap = _interpreters.exec(interpid, script)
|
||||
if excsnap is not None:
|
||||
if excsnap.type.__name__ == 'ImportError':
|
||||
raise ImportError(excsnap.msg)
|
||||
|
||||
def run_with_shared_gil(self, script):
|
||||
interpid = _interpreters.create(isolated=False)
|
||||
excsnap = _interpreters.run_string(interpid, script)
|
||||
def ensure_destroyed():
|
||||
try:
|
||||
_interpreters.destroy(interpid)
|
||||
except _interpreters.InterpreterNotFoundError:
|
||||
pass
|
||||
self.addCleanup(ensure_destroyed)
|
||||
excsnap = _interpreters.exec(interpid, script)
|
||||
if excsnap is not None:
|
||||
if excsnap.type.__name__ == 'ImportError':
|
||||
raise ImportError(excsnap.msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue