Skip to content

Conversation

adqm
Copy link
Contributor

@adqm adqm commented Oct 9, 2025

This patch is an attempt to make code.interact's ctrl+d handling match that of both PyREPL and the Basic REPL, as described in #139875. Specifically, to be consistent with the REPL, we should execute the existing code rather than exiting when receiving ctrl+d on an empty line in a multiline entry.

@adqm
Copy link
Contributor Author

adqm commented Oct 10, 2025

Sorry for a little bit of unintended noise here! When submitting this, I hadn't realized that the sqlite3 CLI depended on InteractiveConsole, so I hadn't anticipated that side effect.

I'm not sure whether there is a reasonable fix that will work both for emulating the Python REPL and for the sqlite CLI, but it does look like my implementation here is too specific (assuming that runsource is always going to be running Python code). Then again, running Python code does seem to be InteractiveConsole's purpose, so it feels odd to me that it's being used for the sqlite CLI instead of, say, cmd).

@adqm
Copy link
Contributor Author

adqm commented Oct 10, 2025

FWIW, I do also have a patch ready (diff) that replaces the sqlite3 CLI with one based on cmd.Cmd, and which passes the existing CLI tests with no adjustments. I'd be happy to submit that as a separate PR if refactoring in that way is viewed as an acceptable solution. I think that it would make sense for the sqlite3 CLI not to use InteractiveConsole, and making that change would also allow this PR to go through.

Of course, happy to discuss.

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