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

Function temp_module

Lib/test/test_crossinterp.py:361–365  ·  view source on GitHub ↗

Create the module and add to sys.modules, then remove it after.

(modname)

Source from the content-addressed store, hash-verified

359
360@contextlib.contextmanager
361def temp_module(modname):
362 """Create the module and add to sys.modules, then remove it after."""
363 assert modname not in sys.modules, (modname,)
364 with import_helper.isolated_modules():
365 yield import_helper.add_module(modname)
366
367
368@contextlib.contextmanager

Calls 1

add_moduleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…