Great fuck-up story
Readlineworks fine- Fallback doesn't work
Fallback fuck-up story
- I tried to send exception to REPL thread:
-
- Exception happens after pressing
Enterin REPL
- Exception happens after pressing
-
- Command line between pressing
Ctrl+CandEnteris ignoring / dropping
- Command line between pressing
- I tried to send signal to REPL thread, but it closes immediately
- I tried to find any API to clear input buffer via ctypes, but:
-
- Linux uses
fgetslibc API. I don't see it's possible to clear the buffer
- Linux uses
-
- Windows uses
ReadConsoleWAPI. Stackoverflow tells it's possible, but I haven't check it
- Windows uses
- I tried to write
\ndirectly into process stdin, but it has no effect -
- On Linux it's simple because of
procfs
- On Linux it's simple because of
-
- MacOS does not have
procfs
- MacOS does not have
-
- Windows have different API
- I tried to simulate key press via ctypes and X11, but got solution becomes a monster:
-
- X11 is Linux-specific back-end
-
- Wayland is Linux-specific back-end too require different solution
-
- Normally it should be
readlineis installed on Linux machines. That's why I think fallback implementation is a big time waste
- Normally it should be
-
- I don't have MacOS device to check any solution
-
- OK, I have a virtual machine with Windows
-
- And it looks easier to install windows python version under wine
But what for? Just install readline and enjoy
So, I don't have a good solution in fallback mode
UPD: I asked people how does default asyncio REPL work on different platforms
and found that on Windows Ctrl+C stops REPL process. It's awful, and I
can't fix it
UPD2: That's why I added PTRepl Extension