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

Method _do_import

Lib/_pyrepl/_module_completer.py:292–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

290 "and propose attributes ]")
291
292 def _do_import() -> str | None:
293 try:
294 importlib.import_module(path)
295 return None
296 except Exception as exc:
297 sys.modules.pop(path, None) # Clean half-imported module
298 self._failed_imports.add(path)
299 return f"[ error during import: {exc} ]"
300
301 return (prompt, _do_import)
302

Callers

nothing calls this directly

Calls 3

import_moduleMethod · 0.45
popMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected