MCPcopy Index your code
hub / github.com/python/cpython / run_temp_from_capi

Method run_temp_from_capi

Lib/test/test_interpreters/utils.py:671–686  ·  view source on GitHub ↗
(self, script, config='legacy')

Source from the content-addressed store, hash-verified

669
670 @requires_test_modules
671 def run_temp_from_capi(self, script, config='legacy'):
672 if config is False:
673 # Force using Py_NewInterpreter().
674 run_in_interp = (lambda s, c: _testcapi.run_in_subinterp(s))
675 config = None
676 else:
677 run_in_interp = _testinternalcapi.run_in_subinterp_with_config
678 if config is True:
679 config = 'default'
680 if isinstance(config, str):
681 config = _interpreters.new_config(config)
682 with self.capturing(script) as (wrapped, results):
683 rc = run_in_interp(wrapped, config)
684 assert rc == 0, rc
685 results.raise_if_failed()
686 return results.stdout

Callers 8

test_whenceMethod · 0.80
test_get_currentMethod · 0.80
test_list_allMethod · 0.80
test_whenceMethod · 0.80

Calls 3

capturingMethod · 0.95
new_configMethod · 0.80
raise_if_failedMethod · 0.80

Tested by 8

test_whenceMethod · 0.64
test_get_currentMethod · 0.64
test_list_allMethod · 0.64
test_whenceMethod · 0.64