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

Function _fix_up_module

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

Source from the content-addressed store, hash-verified

1533# Import setup ###############################################################
1534
1535def _fix_up_module(ns, name, pathname, cpathname=None):
1536 # This function is used by PyImport_ExecCodeModuleObject().
1537 loader = ns.get('__loader__')
1538 spec = ns.get('__spec__')
1539 if not loader:
1540 if spec:
1541 loader = spec.loader
1542 elif pathname == cpathname:
1543 loader = SourcelessFileLoader(name, pathname)
1544 else:
1545 loader = SourceFileLoader(name, pathname)
1546 if not spec:
1547 spec = spec_from_file_location(name, pathname, loader=loader)
1548 if cpathname:
1549 spec.cached = _path_abspath(cpathname)
1550 try:
1551 ns['__spec__'] = spec
1552 ns['__loader__'] = loader
1553 ns['__file__'] = pathname
1554 except Exception:
1555 # Not important enough to report.
1556 pass
1557
1558
1559def _get_supported_file_loaders():

Callers

nothing calls this directly

Calls 5

SourceFileLoaderClass · 0.85
spec_from_file_locationFunction · 0.85
_path_abspathFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…