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

Function _handle_import_error

Lib/multiprocessing/forkserver.py:232–244  ·  view source on GitHub ↗

Handle an import error according to the on_error policy.

(on_error, modinfo, exc, *, warn_stacklevel)

Source from the content-addressed store, hash-verified

230#
231
232def _handle_import_error(on_error, modinfo, exc, *, warn_stacklevel):
233 """Handle an import error according to the on_error policy."""
234 match on_error:
235 case 'fail':
236 raise
237 case 'warn':
238 warnings.warn(
239 f"Failed to preload {modinfo}: {exc}",
240 ImportWarning,
241 stacklevel=warn_stacklevel + 1
242 )
243 case 'ignore':
244 pass
245
246
247def _handle_preload(preload, main_path=None, sys_path=None, sys_argv=None,

Callers 1

_handle_preloadFunction · 0.85

Calls 1

warnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…