Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-131430: Fix crashes on an empty DELETE_WORD_BACKWARDS (^W) followed by CLEAR_TO_START (^K) #131452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
optimize and streamline the writing of pyrepl test code
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
  • Loading branch information
deepwzh and tomasr8 committed May 12, 2025
commit 0e527bad4bd05909b42645dc1dc12cbfd83da31d
12 changes: 5 additions & 7 deletions 12 Lib/test/test_pyrepl/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,10 @@ def test_setpos_from_xy_for_non_printing_char(self):

def test_empty_line_control_w_k(self):
"""Test that Control-W followed by Control-K on an empty line doesn't crash."""
events = itertools.chain(
[
Event(evt="key", data="\x17", raw=bytearray(b"\x17")), # Control-W
Event(evt="key", data="\x0b", raw=bytearray(b"\x0b")), # Control-K
],
)
events = [
Event(evt="key", data="\x17", raw=bytearray(b"\x17")), # Control-W
Event(evt="key", data="\x0b", raw=bytearray(b"\x0b")), # Control-K
]
reader, _ = handle_all_events(events)
self.assert_screen_equal(reader, "", clean=True)
self.assertEqual(reader.pos, 0)
Expand All @@ -375,7 +373,7 @@ def test_control_w_delete_word(self):
"""Test Control-W delete word"""
def test_with_text(text: str, expected: list[str], before_pos: int, after_pos: int):
events = itertools.chain(
code_to_events(text) if len(text) else [],
code_to_events(text),
[Event(evt="key", data="left", raw=bytearray(b"\x1b[D"))] * (len(text) - before_pos), # Move cursor to specified position
deepwzh marked this conversation as resolved.
Show resolved Hide resolved
[
Event(evt="key", data="\x17", raw=bytearray(b"\x17")), # Control-W
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Fix crashes on an empty DELETE_WORD_BACKWARDS (^W) followed by
CLEAR_TO_START (^K). Added comprehensive test cases for both Control-W and
Control-K functionality.
Fix PyREPL crash on an empty DELETE_WORD_BACKWARDS (^W) followed by
CLEAR_TO_START (^K).
Morty Proxy This is a proxified and sanitized view of the page, visit original site.