Skip to content

gh-159072: Correct Ctrl+C documentation for msvcrt.getch() - #159109

Open
jikekei wants to merge 2 commits into
python:mainfrom
jikekei:fix-msvcrt-ctrl-c-docs
Open

jikekei wants to merge 2 commits into
python:mainfrom
jikekei:fix-msvcrt-ctrl-c-docs

Conversation

@jikekei

@jikekei jikekei commented Oct 10, 2026 •

Copy link
Copy Markdown

Correct the library documentation and docstring for msvcrt.getch() to distinguish reading Ctrl+C as a character from invoking a SIGINT handler. Regenerate the Argument Clinic header to keep the built-in help text in sync.

The revised wording says that Ctrl+C, when pressed while the function is waiting for input, can be read as b'\x03' without invoking the signal.SIGINT handler. It avoids making an unconditional guarantee across Windows console environments. Runtime behavior is unchanged.

Validation:

  • Manually tested on Windows 10.0.26200.9457 with CPython 3.14.7 (64-bit), using a custom handler registered with signal.signal(signal.SIGINT, handler): Ctrl+C during getch() returned b'\x03' without calling the handler. In a separate input phase, Ctrl+C during input() called the handler with SIGINT (2), after which input() raised EOFError.
  • Repeated the comparison in independent Windows PTY processes, sending one Ctrl+C input after each READY prompt. The observations matched the manual test. These tests do not establish behavior across all Windows console hosts or directly measure underlying OS control events.
  • Regenerated Argument Clinic output and confirmed that a second run produces no changes.
  • Passed sphinx-lint for Doc/library/msvcrt.rst and git diff --check.
  • Rebuilt HTML documentation with -W --keep-going using the cached environment; the updated build passed. The initial source-reading pass for the original change reported an existing duplicate customization label in the unchanged Doc/using/windows.rst and Doc/reference/datamodel.rst files.

@jikekei
jikekei requested a review from a team as a code owner October 10, 2026 10:19
@python-cla-bot

python-cla-bot Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Oct 10, 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.

@read-the-docs-community

read-the-docs-community Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35061291 | 📁 Comparing ffd7cf0 against main (7d5dce9)

  🔍 Preview build  

1 file changed
± library/msvcrt.html

@bedevere-app

bedevere-app Bot commented Oct 10, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant