Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTRL+C/KeyboardInterrupt in editline not working properly on macOS REPL #100610

Open
milosivanovic opened this issue Dec 30, 2022 · 2 comments
Open
Labels
OS-mac topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@milosivanovic
Copy link

Bug report

With the following in ~/.editrc:

bind "^R" em-inc-search-prev

Pressing CTRL+R inside the macOS-bundled python (/usr/bin/python3, which is compiled against editline) to enter editline history, and then pressing CTRL+C does not properly remove "bck" and does not write KeyboardInterrupt until CTRL+C is pressed two more times for a total of three times.

In other words, inside an editline history search, CTRL+C needs to be sent three times to get back to the normal REPL state.

This video may help with understanding the issue: Homebrew/homebrew-core#118869 (comment)

Your environment

  • CPython versions tested on: 3.9.6
  • Operating system and architecture: macOS Monterey 12.6.1 / M1 / arm64
@ned-deily
Copy link
Member

ned-deily commented Dec 30, 2022

To be clear, /usr/bin/python3 is the python supplied by Apple as part of Xcode or the Command Line Tools and not Homebrew or python.org macOS installers.

@milosivanovic
Copy link
Author

milosivanovic commented Dec 30, 2022

Since python.org's DMG is also built against editline, it's expected to have the same issue. I just installed it and confirmed the same problem exists there (see the video for a better understanding):

milos@air:~$ which python3
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
milos@air:~$ python3
Python 3.11.1 (v3.11.1:a7a450f84a, Dec  6 2022, 15:24:06) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^CenSSL
bck:O
^C
KeyboardInterrupt
>>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-mac topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants