diff --git a/Lib/_pyrepl/console.py b/Lib/_pyrepl/console.py
index 8956fb1242e52a..3c1ca6f682659d 100644
--- a/Lib/_pyrepl/console.py
+++ b/Lib/_pyrepl/console.py
@@ -153,8 +153,6 @@ def repaint(self) -> None: ...
class InteractiveColoredConsole(code.InteractiveConsole):
- STATEMENT_FAILED = object()
-
def __init__(
self,
locals: dict[str, object] | None = None,
@@ -176,16 +174,6 @@ def _excepthook(self, typ, value, tb):
limit=traceback.BUILTIN_EXCEPTION_LIMIT)
self.write(''.join(lines))
- def runcode(self, code):
- try:
- exec(code, self.locals)
- except SystemExit:
- raise
- except BaseException:
- self.showtraceback()
- return self.STATEMENT_FAILED
- return None
-
def runsource(self, source, filename="", symbol="single"):
try:
tree = self.compile.compiler(
@@ -223,7 +211,5 @@ def runsource(self, source, filename="", symbol="single"):
if code is None:
return True
- result = self.runcode(code)
- if result is self.STATEMENT_FAILED:
- break
+ self.runcode(code)
return False
diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py
index 69f5a30cfe5095..95c636f9e02866 100644
--- a/Lib/asyncio/__main__.py
+++ b/Lib/asyncio/__main__.py
@@ -75,7 +75,7 @@ def callback():
self.write("\nKeyboardInterrupt\n")
else:
self.showtraceback()
- return self.STATEMENT_FAILED
+
class REPLThread(threading.Thread):
diff --git a/Lib/test/test_pyrepl/test_interact.py b/Lib/test/test_pyrepl/test_interact.py
index 2651cf7d32d79d..8b941b93670e84 100644
--- a/Lib/test/test_pyrepl/test_interact.py
+++ b/Lib/test/test_pyrepl/test_interact.py
@@ -53,19 +53,6 @@ def test_multiple_statements_output(self):
self.assertFalse(more)
self.assertEqual(f.getvalue(), "1\n")
- @force_not_colorized
- def test_multiple_statements_fail_early(self):
- console = InteractiveColoredConsole()
- code = dedent("""\
- raise Exception('foobar')
- print('spam&eggs')
- """)
- f = io.StringIO()
- with contextlib.redirect_stderr(f):
- console.runsource(code)
- self.assertIn('Exception: foobar', f.getvalue())
- self.assertNotIn('spam&eggs', f.getvalue())
-
def test_empty(self):
namespace = {}
code = ""
diff --git a/Lib/test/test_repl.py b/Lib/test/test_repl.py
index 1e4b48622b9383..fdaff5b99bb803 100644
--- a/Lib/test/test_repl.py
+++ b/Lib/test/test_repl.py
@@ -294,15 +294,7 @@ def f():
self.assertEqual(traceback_lines, expected_lines)
-class TestAsyncioREPL(unittest.TestCase):
- def test_multiple_statements_fail_early(self):
- user_input = "1 / 0; print('afterwards')"
- p = spawn_repl("-m", "asyncio")
- p.stdin.write(user_input)
- output = kill_python(p)
- self.assertIn("ZeroDivisionError", output)
- self.assertNotIn("afterwards", output)
-
+class TestAsyncioREPLContextVars(unittest.TestCase):
def test_toplevel_contextvars_sync(self):
user_input = dedent("""\
from contextvars import ContextVar
diff --git a/Misc/NEWS.d/next/Library/2025-01-30-22-49-42.gh-issue-128231.SuEC18.rst b/Misc/NEWS.d/next/Library/2025-01-30-22-49-42.gh-issue-128231.SuEC18.rst
deleted file mode 100644
index a70b6a1fc14d63..00000000000000
--- a/Misc/NEWS.d/next/Library/2025-01-30-22-49-42.gh-issue-128231.SuEC18.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Execution of multiple statements in the new REPL now stops immediately upon
-the first exception encountered. Patch by Bartosz Sławecki.