Skip to content

Fix input assuming the last character being a '\n'#149237

Open
Virv12 wants to merge 2 commits intopython:mainfrom
Virv12:fix-newline
Open

Fix input assuming the last character being a '\n'#149237
Virv12 wants to merge 2 commits intopython:mainfrom
Virv12:fix-newline

Conversation

@Virv12
Copy link
Copy Markdown

@Virv12 Virv12 commented May 1, 2026

Fix input assuming the last character being a '\n'

When reading from the tty python's builtin input function assumes that the last character read is a newline and proceed to strip it out leading to missing input.

Current behaviour:

$ ./python -c 'print(repr(input()))'     # press ^D three times to send EOF without a newline
abc'ab'

Expected behaviour:

$ ./python -c 'print(repr(input()))'
abc'abc'

@Virv12 Virv12 requested a review from ericsnowcurrently as a code owner May 1, 2026 15:03
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 1, 2026

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.

@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented May 1, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32507308 | 📁 Comparing b8b6bf9 against main (bb5e41e)

  🔍 Preview build  

31 files changed · ± 31 modified

± Modified

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant