GeezerVison is showing github.com — gh-144338: Improve cmd.Cmd docs for emptyline() and do_EOF by Anandesh-Sharma · Pull Request #145292 · python/cpython
Conversation
Anandesh-Sharma
commented
Feb 26, 2026
•
edited by github-actions
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Addresses #144338 by improving the cmd.Cmd documentation to make the emptyline() and do_EOF patterns more discoverable:
- Add a note to
cmdloop() docs that do_EOF should be defined to handle Ctrl-D/EOF gracefully, with a cross-reference to the example
- Add a practical tip to
emptyline() docs about overriding with pass to suppress the default repeat-last-command behavior
- Add
emptyline() and do_EOF() methods to the existing TurtleShell example to demonstrate these common patterns
These are the two most commonly needed overrides that new cmd.Cmd users struggle to discover from the current documentation.
Closes #144338
Test plan
- Documentation builds without warnings
- Example code in docs is syntactically correct
📚 Documentation preview 📚: https://cpython-previews--145292.org.readthedocs.build/
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
- Document that do_EOF should be defined to handle Ctrl-D gracefully,
with a cross-reference to the example
- Add a note to emptyline() docs about overriding with pass to suppress
the default repeat-last-command behavior
- Add emptyline() and do_EOF() to the TurtleShell example to demonstrate
these common patterns
Closes python#144338
Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
The following commit authors need to sign the Contributor License Agreement:

|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Closing, CLA is unsigned.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.