summaryrefslogtreecommitdiffstats
path: root/Lib/runpy.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2023-04-28 23:17:58 (GMT)
committerGitHub <noreply@github.com>2023-04-28 23:17:58 (GMT)
commite1f14643dc0e6024f8df9ae975c3b05912a3cb28 (patch)
tree00bb66f68cadb9457a2a9486873ecf13be0241d6 /Lib/runpy.py
parent79b9db9295a5a1607a0b4b10a8b4b72567eaf1ef (diff)
downloadcpython-e1f14643dc0e6024f8df9ae975c3b05912a3cb28.zip
cpython-e1f14643dc0e6024f8df9ae975c3b05912a3cb28.tar.gz
cpython-e1f14643dc0e6024f8df9ae975c3b05912a3cb28.tar.bz2
gh-98040: Remove just the `imp` module (#98573)
Diffstat (limited to 'Lib/runpy.py')
-rw-r--r--Lib/runpy.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/Lib/runpy.py b/Lib/runpy.py
index 54fc136..42f896c 100644
--- a/Lib/runpy.py
+++ b/Lib/runpy.py
@@ -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)