(run_name, fname)
| 271 | |
| 272 | |
| 273 | def _get_code_from_file(run_name, fname): |
| 274 | # Check for a compiled file first |
| 275 | from pkgutil import read_code |
| 276 | |
| 277 | decoded_path = os.path.abspath(os.fsdecode(fname)) |
| 278 | with io_open_code(decoded_path) as f: |
| 279 | code = read_code(f) |
| 280 | if code is None: |
| 281 | # That didn't work, so try it as normal source code |
| 282 | with io_open_code(decoded_path) as f: |
| 283 | code = compile(f.read(), fname, "exec") |
| 284 | return code, fname |
| 285 | |
| 286 | |
| 287 | def run_path(path_name, init_globals=None, run_name=None): |