mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
gh-98040: Remove just the imp
module (#98573)
This commit is contained in:
parent
79b9db9295
commit
e1f14643dc
24 changed files with 40 additions and 1537 deletions
|
@ -279,12 +279,7 @@ def run_path(path_name, init_globals=None, run_name=None):
|
|||
pkg_name = run_name.rpartition(".")[0]
|
||||
from pkgutil import get_importer
|
||||
importer = get_importer(path_name)
|
||||
# Trying to avoid importing imp so as to not consume the deprecation warning.
|
||||
is_NullImporter = False
|
||||
if type(importer).__module__ == 'imp':
|
||||
if type(importer).__name__ == 'NullImporter':
|
||||
is_NullImporter = True
|
||||
if isinstance(importer, type(None)) or is_NullImporter:
|
||||
if isinstance(importer, type(None)):
|
||||
# Not a valid sys.path entry, so run the code directly
|
||||
# execfile() doesn't help as we want to allow compiled files
|
||||
code, fname = _get_code_from_file(run_name, path_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue