[3.13] gh-126332: Fix pyrepl crash for double ctrl-z in line overflow… · python/cpython@0c70453 · GitHub
Skip to content

Commit 0c70453

Browse files
miss-islingtoneendebakptblurb-it[bot]
authored
[3.13] gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650) (#129154)
gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650) (cherry picked from commit d147e5e) Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent ffcef2d commit 0c70453

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

Lib/_pyrepl/utils.py

Lines changed: 1 addition & 1 deletion

Lib/test/test_pyrepl/test_windows_console.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,20 @@ def move_right(self, cols=1):
329329
def erase_in_line(self):
330330
return ERASE_IN_LINE.encode("utf8")
331331

332+
def test_multiline_ctrl_z(self):
333+
# see gh-126332
334+
code = "abcdefghi"
335+
336+
events = itertools.chain(
337+
code_to_events(code),
338+
[
339+
Event(evt="key", data='\x1a', raw=bytearray(b'\x1a')),
340+
Event(evt="key", data='\x1a', raw=bytearray(b'\x1a')),
341+
],
342+
)
343+
reader, _ = self.handle_events_narrow(events)
344+
self.assertEqual(reader.cxy, (2, 3))
345+
332346

333347
if __name__ == "__main__":
334348
unittest.main()
Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)