summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/pyshell.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/pyshell.py')
-rwxr-xr-xLib/idlelib/pyshell.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index 8b07d52..ee13131 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -635,6 +635,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
if source is None:
with tokenize.open(filename) as fp:
source = fp.read()
+ if use_subprocess:
+ source = (f"__file__ = r'''{os.path.abspath(filename)}'''\n"
+ + source + "\ndel __file__")
try:
code = compile(source, filename, "exec")
except (OverflowError, SyntaxError):