Skip to content

Commit fd5cd26

Browse files
Merge branch '3.13' into unrevert-datetime-multiphase-init
2 parents 81bb872 + 40a024c commit fd5cd26

18 files changed

+70
-22
lines changed

Lib/_pyrepl/simple_interact.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def runsource(self, source, filename="<input>", symbol="single"):
9595
the_symbol = symbol if stmt is last_stmt else "exec"
9696
item = wrapper([stmt])
9797
try:
98-
code = compile(item, filename, the_symbol)
99-
except (OverflowError, ValueError):
98+
code = compile(item, filename, the_symbol, dont_inherit=True)
99+
except (OverflowError, ValueError, SyntaxError):
100100
self.showsyntaxerror(filename)
101101
return False
102102

Lib/test/test_pyrepl/test_interact.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,20 @@ def test_runsource_shows_syntax_error_for_failed_compilation(self):
9494
with patch.object(console, "showsyntaxerror") as mock_showsyntaxerror:
9595
console.runsource(source)
9696
mock_showsyntaxerror.assert_called_once()
97+
source = dedent("""\
98+
match 1:
99+
case {0: _, 0j: _}:
100+
pass
101+
""")
102+
with patch.object(console, "showsyntaxerror") as mock_showsyntaxerror:
103+
console.runsource(source)
104+
mock_showsyntaxerror.assert_called_once()
105+
106+
def test_no_active_future(self):
107+
console = InteractiveColoredConsole()
108+
source = "x: int = 1; print(__annotations__)"
109+
f = io.StringIO()
110+
with contextlib.redirect_stdout(f):
111+
result = console.runsource(source)
112+
self.assertFalse(result)
113+
self.assertEqual(f.getvalue(), "{'x': <class 'int'>}\n")

Makefile.pre.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ LIBEXPAT_HEADERS= \
631631
Modules/expat/utf8tab.h \
632632
Modules/expat/xmlrole.h \
633633
Modules/expat/xmltok.h \
634-
Modules/expat/xmltok_impl.h
634+
Modules/expat/xmltok_impl.h \
635+
Modules/expat/xmltok_impl.c \
636+
Modules/expat/xmltok_ns.c
635637

636638
##########################################################################
637639
# hashlib's HACL* library
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The interactive REPL no longer runs with ``from __future__ import
2+
annotations`` enabled. Patch by Jelle Zijlstra.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Catch :exc:`SyntaxError` from :func:`compile` in the runsource() method of
2+
the InteractiveColoredConsole. Patch by Sergey B Kirpichev.

Modules/_ctypes/clinic/_ctypes.c.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/bufferedio.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/iobase.c.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/textio.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_curses_panel.c.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)