GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-146044: Fix ctrl-w (unix-word-rubout) to use whitespace word boundaries by kimimgo · Pull Request #146174 · python/cpython

Conversation

@kimimgo

@kimimgo kimimgo commented Mar 19, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #146044

Summary

The unix-word-rubout command (ctrl-w) was using bow() which treats
punctuation as word separators via the syntax table. This differs from
bash/readline's unix-word-rubout which uses only whitespace as boundaries.

Changes

  • reader.py: Add bow_whitespace() method — same as bow() but only
    considers spaces and newlines as word boundaries
  • commands.py: unix_word_rubout now calls bow_whitespace() instead of bow()
  • test_reader.py: Add TestBowWhitespace class with 4 tests verifying
    the whitespace-only behavior and the difference from bow()

Example

With buffer foo.bar baz and cursor at end:

  • Before: ctrl-w deletes baz, then bar, then foo (3 operations)
  • After: ctrl-w deletes baz, then foo.bar (2 operations, matching bash)

The existing bow() method used by backward-kill-word (M-Backspace) is unchanged.

  • Issue: ctrl-w deletes words with punctuation instead of whitespace boundary #146044

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kimimgo
Fix ctrl-w (unix-word-rubout) to use whitespace word boundaries (pyth…
678eefd
…on#146044)

The unix-word-rubout command (ctrl-w) was using syntax_table-based
word boundaries (bow()), which treats punctuation as word separators.
This differs from bash/readline's unix-word-rubout which uses only
whitespace as word boundaries.

Add bow_whitespace() method that uses whitespace-only boundaries,
and use it in unix_word_rubout instead of bow(). The existing bow()
method (used by backward-kill-word/M-Backspace) is unchanged.

Example: with 'foo.bar baz' and cursor at end:
- Before (bow): ctrl-w deletes 'baz', then 'bar', then 'foo'
- After (bow_whitespace): ctrl-w deletes 'baz', then 'foo.bar'
@kimimgo
kimimgo requested review from ambv, lysnikolaou and pablogsal as code owners March 19, 2026 15:28
@python-cla-bot

python-cla-bot Bot commented Mar 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

bedevere-app Bot commented Mar 19, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot mentioned this pull request Mar 19, 2026
ctrl-w deletes words with punctuation instead of whitespace boundary #146044
Open
@bedevere-app bedevere-app Bot added the awaiting review label Mar 19, 2026
@okiemute04 okiemute04 mentioned this pull request Mar 19, 2026
gh-145866 : Update JIT contributor list (GH-146170) #146177
Closed
@kimimgo
Fix test: prepare_console() requires events argument
853cb8c
@bedevere-app

bedevere-app Bot commented Mar 19, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
5aef976
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
@okiemute04 okiemute04 mentioned this pull request Mar 19, 2026
gh-146169: Prevent re-entrant Parse() calls in pyexpat #146179
Closed
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
58534a3
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
2368c9d
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
4557157
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
afe297f
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
4146ff1
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
00844fd
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
b6c2df5
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
okiemute04 added a commit to okiemute04/cpython that referenced this pull request Mar 19, 2026
@okiemute04
pythongh-146174: Prevent re-entrant Parse() calls in pyexpat
c924f57
Add a check in Parse() to prevent calls when in_callback is true,
as this violates expat's requirements and can cause crashes. Now raises
RuntimeError with a clear message.

Add tests to verify the fix and ensure normal parsing still works.
@kimimgo
Add NEWS entry for pythongh-146044
99023b2
@picnixz

picnixz commented Mar 20, 2026

Copy link
Copy Markdown
Member

I personally prefer stopping at separators rather than whitespaces. I think zsh stops at punctuations. So I would first open a DPO thread about this before changing anything.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kimimgo

kimimgo commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @picnixz!

The distinction I'm making is between two different readline commands:

  • unix-word-rubout (Ctrl-W): POSIX/bash definition uses whitespace-only boundaries. From the GNU Readline docs: "Kill the word behind point, using white space as a word boundary."
  • backward-kill-word (M-Backspace): Uses syntax-table boundaries (stops at punctuation), which is the current bow() behavior.

The current code maps Ctrl-W to unix_word_rubout but uses bow() (syntax-table/punctuation boundaries), which matches backward-kill-word behavior instead.

This PR keeps bow() unchanged for backward-kill-word — it only changes unix_word_rubout to use whitespace boundaries, matching the readline specification.

That said, I'm happy to open a Discourse thread if you think this needs broader discussion first.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented Mar 20, 2026

Copy link
Copy Markdown
Member

I am a bit torn here... I would say M-backspace is... less convenient to type but at the same time if ctrl+w is meant to emulate the Unix one then I guess it may be better to ensure this.

What is the behavior on the old REPL? (in 3.12?)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@injust

injust commented Mar 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I think zsh stops at punctuations.

ctrl-w (unix-word-rubout) uses whitespace boundaries on bash, zsh, and fish on macOS.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@injust

injust commented Mar 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What is the behavior on the old REPL? (in 3.12?)

ctrl-w stops on whitespace boundaries in the 3.12 REPL.

unix_word_rubout and backward_kill_word had the same implementation since 3.13, so this looks like a bug that was just missed until now.

picnixz reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kimimgo

kimimgo commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @injust for confirming the cross-shell behavior and the 3.12 regression!

To summarize: this is a regression introduced in 3.13's pyrepl where unix_word_rubout and backward_kill_word were given the same bow() implementation. In 3.12 (GNU readline), ctrl-w correctly used whitespace boundaries.

This PR restores the 3.12 behavior by adding bow_whitespace() for unix_word_rubout while keeping bow() (syntax-table based) for backward_kill_word.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Mar 21, 2026
picnixz
picnixz requested changes Mar 21, 2026
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but please make tests less LLM-esque.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/_pyrepl/reader.py Outdated
p -= 1
return p + 1

def bow_whitespace(self, p: int | None = None) -> int:

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe unix_bow() instead? or bow_ws()? since we use quite short names.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py Outdated

class TestBowWhitespace(TestCase):
def test_bow_whitespace_stops_at_whitespace(self):
# GH#146044

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        # See https://github.com/cpython/issues/146044

Use a link looking like that so that I can click on it in my IDE. I created the link from memory sonjust check that it is the correct URL.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py Outdated
reader.pos = len(reader.buffer)

result = reader.bow()
self.assertEqual(result, 8) # same — "baz" is all word chars

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.assertEqual(result, 8) # same — "baz" is all word chars
self.assertEqual(result, 8) # same: "baz" is all word chars

Avoid LLM long dashes and use regular english please

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py Outdated
reader.buffer = list("foo.bar")
reader.pos = len(reader.buffer)

# bow() stops at '.' → returns index of 'b' in "bar"

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# bow() stops at '.' → returns index of 'b' in "bar"
# bow() stops at '.' so we return the index of 'b' in "bar"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/NEWS.d/next/Library/2026-03-20-00-00-01.gh-issue-146044.WsCtrl.rst Outdated
@@ -0,0 +1,3 @@
Fix ``unix-word-rubout`` (Ctrl-W) in the REPL to use whitespace-only word
boundaries, matching bash/readline behavior. Previously it used

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
boundaries, matching bash/readline behavior. Previously it used
boundaries, matching behavior of the basic REPL. Previously it used

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py Outdated
self.assert_screen_equal(reader, 'flag {o}={z} {s}"🏳️\\u200d🌈"{z}'.format(**colors))


class TestBowWhitespace(TestCase):

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire test case can have one single reference to the GH issue as a comment and we can remove them from the methods.

However I would prefer that we extend the existing test case with the bow tests and place them where existing ones are.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting review labels Mar 21, 2026
@bedevere-app

bedevere-app Bot commented Mar 21, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz reviewed Mar 21, 2026
View reviewed changes
Comment thread Lib/_pyrepl/reader.py Outdated
p -= 1
while p >= 0 and b[p] in (" ", "\n"):
p -= 1
while p >= 0 and b[p] not in (" ", "\n"):

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while p >= 0 and b[p] not in (" ", "\n"):
while p >= 0 and b[p] not in " \n":

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/_pyrepl/reader.py Outdated
p = self.pos
b = self.buffer
p -= 1
while p >= 0 and b[p] in (" ", "\n"):

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while p >= 0 and b[p] in (" ", "\n"):
while p >= 0 and b[p] in " \n":

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/_pyrepl/reader.py Outdated
p -= 1
while p >= 0 and b[p] in (" ", "\n"):
p -= 1
while p >= 0 and b[p] not in (" ", "\n"):

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOC newlines are also counted but what about tabs? do we also convert them to 4-indents in the REPL or?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kimimgo
Address review: rename bow_ws, move tests to TestReader, add tab support
e6d27d9
- Rename bow_whitespace() to bow_ws() for shorter naming convention
- Move tests from separate TestBowWhitespace class into TestReader
- Add tab character to whitespace set (space, newline, tab)
- Add test_bow_ws_with_tabs for tab handling
- Fix link format to python#146044
- Remove LLM-style long dashes from comments
- Update NEWS wording per review
@kimimgo

kimimgo commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @picnixz! Updated:

  • Renamed bow_whitespace() → bow_ws() for shorter naming
  • Moved all tests into TestReader (removed separate class)
  • Added \t to the whitespace set and a test_bow_ws_with_tabs test
  • Fixed link format to https://github.com/python/cpython/issues/146044
  • Removed long dashes, cleaned up comment style
  • Updated NEWS wording
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz reviewed Mar 21, 2026
View reviewed changes
Comment thread Lib/_pyrepl/reader.py Outdated

p defaults to self.pos; only whitespace is considered a word
boundary, matching the behavior of unix-word-rubout in bash/readline.
See https://github.com/python/cpython/issues/146044"""

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
See https://github.com/python/cpython/issues/146044"""
"""

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py
Comment on lines +387 to +388
self.assertEqual(reader.bow_ws(), 4)

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.assertEqual(reader.bow_ws(), 4)
self.assertEqual(reader.bow_ws(), 4)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py
reader.setpos_from_xy(8, 0)
self.assertEqual(reader.pos, 7)

def test_bow_ws_stops_at_whitespace(self):

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the existing tests for bow()? id there are some, please put those tests next to them

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py Outdated
def test_bow_ws_includes_punctuation_in_word(self):
reader = prepare_reader(prepare_console([]))
reader.buffer = list("foo.bar(baz) qux")
reader.pos = 12

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the index() method to get the index of )

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py

def test_bow_ws_with_tabs(self):
reader = prepare_reader(prepare_console([]))
reader.buffer = list("foo\tbar")

@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tests with \n and ensure that you also properly jump lines.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py Outdated
Comment on lines +589 to +590


@picnixz picnixz Mar 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove those extra blanks

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kimimgo added 2 commits March 21, 2026 23:09
@kimimgo
Fix trailing blank lines in test_reader.py
9f54090
@kimimgo
Address review: close docstring on separate line
140faf1
picnixz
picnixz reviewed Mar 22, 2026
View reviewed changes
Comment thread Lib/_pyrepl/reader.py Outdated

p defaults to self.pos; only whitespace is considered a word
boundary, matching the behavior of unix-word-rubout in bash/readline.
See https://github.com/python/cpython/issues/146044

@picnixz picnixz Mar 22, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion was to remove the ref to the issue

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py Outdated
self.assertEqual(reader.pos, 7)

def test_bow_ws_stops_at_whitespace(self):
# See https://github.com/python/cpython/issues/146044

@picnixz picnixz Mar 22, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# See https://github.com/python/cpython/issues/146044
# See https://github.com/python/cpython/issues/146044.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kimimgo added 2 commits March 27, 2026 19:58
@kimimgo
Address review: remove issue URL from docstring, add newline test
c8d1759
Per @picnixz's review:
- Remove issue URL from bow_ws() docstring (keep reference in tests only)
- Add period to issue reference comment in test
- Add test_bow_ws_with_newlines to cover newline as whitespace boundary
@kimimgo
Address review: use index() instead of magic number for pos
0a25f0b
@picnixz

picnixz commented Apr 2, 2026

Copy link
Copy Markdown
Member

Please stop pinging me that frequently. My backlog is nontrivial and it may take more than 1 month for a review. Those comments do not help either as they just repeat what you already did once.

kimimgo reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 8, 2026
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.15 bugs and security fixes label May 30, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 3, 2026
pablogsal
pablogsal reviewed Jul 11, 2026
View reviewed changes
Comment thread Lib/_pyrepl/reader.py
p = self.pos
b = self.buffer
p -= 1
while p >= 0 and b[p] in " \n\t":

@pablogsal pablogsal Jul 11, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already use c.isspace() for whitespace in kill_line just above the caller in commands.py. Why hardcode " \n\t" here twice instead? b[p].isspace() would be consistent and also cover \r/\f/\v.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pyrepl/test_reader.py
reader.setpos_from_xy(8, 0)
self.assertEqual(reader.pos, 7)

def test_bow_ws_stops_at_whitespace(self):

@pablogsal pablogsal Jul 11, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These only exercise bow_ws() directly. Do we have a test that drives the actual unix-word-rubout (ctrl-w) command end to end? That is the behavior we are fixing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions

github-actions Bot commented Oct 10, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz requested changes
@pablogsal pablogsal pablogsal left review comments
@lysnikolaou lysnikolaou Awaiting requested review from lysnikolaou lysnikolaou is a code owner
@ambv ambv Awaiting requested review from ambv ambv is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes stale Stale PR or inactive for long period of time.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ctrl-w deletes words with punctuation instead of whitespace boundary

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@kimimgo @picnixz @injust @pablogsal @serhiy-storchaka
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.