mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-111201: Allow pasted code to contain multiple statements in the REPL (#118712)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
26bab423fb
commit
a94ac56628
6 changed files with 33 additions and 9 deletions
|
@ -281,7 +281,7 @@ class InteractiveConsole(InteractiveInterpreter):
|
|||
elif exitmsg != '':
|
||||
self.write('%s\n' % exitmsg)
|
||||
|
||||
def push(self, line, filename=None):
|
||||
def push(self, line, filename=None, _symbol="single"):
|
||||
"""Push a line to the interpreter.
|
||||
|
||||
The line should not have a trailing newline; it may have
|
||||
|
@ -299,7 +299,7 @@ class InteractiveConsole(InteractiveInterpreter):
|
|||
source = "\n".join(self.buffer)
|
||||
if filename is None:
|
||||
filename = self.filename
|
||||
more = self.runsource(source, filename)
|
||||
more = self.runsource(source, filename, symbol=_symbol)
|
||||
if not more:
|
||||
self.resetbuffer()
|
||||
return more
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue