(ns, name, pathname, cpathname=None)
| 1507 | # Import setup ############################################################### |
| 1508 | |
| 1509 | def _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 | |
| 1534 | def _get_supported_file_loaders(): |
nothing calls this directly
no test coverage detected