summaryrefslogtreecommitdiffstats
path: root/Lib/code.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-05-07 16:01:49 (GMT)
committerGitHub <noreply@github.com>2024-05-07 16:01:49 (GMT)
commita94ac566285662b214ca97d74481e07e51ccd7d9 (patch)
tree23f91530e49c539081053dbb0ba63e90a6677414 /Lib/code.py
parent26bab423fb6e08f9df23c5c8f55e3d019150c454 (diff)
downloadcpython-a94ac566285662b214ca97d74481e07e51ccd7d9.zip
cpython-a94ac566285662b214ca97d74481e07e51ccd7d9.tar.gz
cpython-a94ac566285662b214ca97d74481e07e51ccd7d9.tar.bz2
gh-111201: Allow pasted code to contain multiple statements in the REPL (#118712)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/code.py')
-rw-r--r--Lib/code.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/code.py b/Lib/code.py
index 1ee1ad6..9d12456 100644
--- a/Lib/code.py
+++ b/Lib/code.py
@@ -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