Try importing the named module in a subinterpreter. The subinterpreter will be in the current process. The module will have already been imported in the main interpreter. Thus, for extension/builtin modules, the module definition will have been loaded alread
(self, name, filename=None, *,
check_singlephase_setting=False,
check_singlephase_override=None,
isolated=False,
)
| 2224 | ''') |
| 2225 | |
| 2226 | def run_here(self, name, filename=None, *, |
| 2227 | check_singlephase_setting=False, |
| 2228 | check_singlephase_override=None, |
| 2229 | isolated=False, |
| 2230 | ): |
| 2231 | """ |
| 2232 | Try importing the named module in a subinterpreter. |
| 2233 | |
| 2234 | The subinterpreter will be in the current process. |
| 2235 | The module will have already been imported in the main interpreter. |
| 2236 | Thus, for extension/builtin modules, the module definition will |
| 2237 | have been loaded already and cached globally. |
| 2238 | |
| 2239 | "check_singlephase_setting" determines whether or not |
| 2240 | the interpreter will be configured to check for modules |
| 2241 | that are not compatible with use in multiple interpreters. |
| 2242 | |
| 2243 | This should always return "okay" for all modules if the |
| 2244 | setting is False (with no override). |
| 2245 | """ |
| 2246 | __import__(name) |
| 2247 | |
| 2248 | kwargs = dict( |
| 2249 | **self.RUN_KWARGS, |
| 2250 | **(self.ISOLATED if isolated else self.NOT_ISOLATED), |
| 2251 | check_multi_interp_extensions=check_singlephase_setting, |
| 2252 | ) |
| 2253 | |
| 2254 | r, w = self.pipe() |
| 2255 | script = self.import_script(name, w, filename, |
| 2256 | check_singlephase_override) |
| 2257 | |
| 2258 | ret = run_in_subinterp_with_config(script, **kwargs) |
| 2259 | self.assertEqual(ret, 0) |
| 2260 | return os.read(r, 100) |
| 2261 | |
| 2262 | def check_compatible_here(self, name, filename=None, *, |
| 2263 | strict=False, |
no test coverage detected