Skip to content

Commit ee767d8

Browse files
committed
be consistent w/ the console's filename: '<stdin>', to match cpython
1 parent bdafcec commit ee767d8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pyrepl/python_reader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ def run_user_init_file(self):
186186

187187
def execute(self, text):
188188
try:
189-
# ooh, look at the hack:
190-
code = self.compile(text, '<input>', 'single')
189+
# ooh, look at the hack:
190+
code = self.compile(text, '<stdin>', 'single')
191191
except (OverflowError, SyntaxError, ValueError):
192-
self.showsyntaxerror("<input>")
192+
self.showsyntaxerror("<stdin>")
193193
else:
194194
self.runcode(code)
195195
if sys.stdout and not sys.stdout.closed:

pyrepl/simple_interact.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ def run_multiline_interactive_console(mainmodule=None):
3939
import code
4040
import __main__
4141
mainmodule = mainmodule or __main__
42-
console = code.InteractiveConsole(mainmodule.__dict__)
42+
console = code.InteractiveConsole(mainmodule.__dict__, filename='<stdin>')
4343

4444
def more_lines(unicodetext):
4545
# ooh, look at the hack:
4646
src = "#coding:utf-8\n"+unicodetext.encode('utf-8')
4747
try:
48-
code = console.compile(src, '<input>', 'single')
48+
code = console.compile(src, '<stdin>', 'single')
4949
except (OverflowError, SyntaxError, ValueError):
5050
return False
5151
else:

0 commit comments

Comments
 (0)