(ns, name, pathname, cpathname=None)
| 1533 | # Import setup ############################################################### |
| 1534 | |
| 1535 | def _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 | |
| 1559 | def _get_supported_file_loaders(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…