MCPcopy Index your code
hub / github.com/RustPython/RustPython / _fix_up_module

Function _fix_up_module

Lib/importlib/_bootstrap_external.py:1509–1531  ·  view source on GitHub ↗
(ns, name, pathname, cpathname=None)

Source from the content-addressed store, hash-verified

1507# Import setup ###############################################################
1508
1509def _fix_up_module(ns, name, pathname, cpathname=None):
1510 # This function is used by PyImport_ExecCodeModuleObject().
1511 loader = ns.get('__loader__')
1512 spec = ns.get('__spec__')
1513 if not loader:
1514 if spec:
1515 loader = spec.loader
1516 elif pathname == cpathname:
1517 loader = SourcelessFileLoader(name, pathname)
1518 else:
1519 loader = SourceFileLoader(name, pathname)
1520 if not spec:
1521 spec = spec_from_file_location(name, pathname, loader=loader)
1522 if cpathname:
1523 spec.cached = _path_abspath(cpathname)
1524 try:
1525 ns['__spec__'] = spec
1526 ns['__loader__'] = loader
1527 ns['__file__'] = pathname
1528 ns['__cached__'] = cpathname
1529 except Exception:
1530 # Not important enough to report.
1531 pass
1532
1533
1534def _get_supported_file_loaders():

Callers

nothing calls this directly

Calls 5

SourceFileLoaderClass · 0.70
spec_from_file_locationFunction · 0.70
_path_abspathFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected