Blog: 2025-03-18
Jump to navigation
Jump to search
Found this python repl bug. I remember hitting the up arrow, thinking I'd assign to _
since I wanted to keep using that value, then when I hit control+k to clear a typo or something I got this error:
new1 $ python Python 3.13.1 (main, Jan 29 2025, 03:21:14) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite Traceback (most recent call last): File "<python-input-0>", line 1, in <module> import sqlite ModuleNotFoundError: No module named 'sqlite' >>> import sqlite3 >>> sqlite3.connect('test.db') <sqlite3.Connection object at 0x104197f10> >>> Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/__main__.py", line 6, in <module> __pyrepl_interactive_console() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/main.py", line 59, in interactive_console run_multiline_interactive_console(console) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/simple_interact.py", line 151, in run_multiline_interactive_console statement = multiline_input(more_lines, ps1, ps2) File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/readline.py", line 389, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/reader.py", line 801, in readline self.handle1() ~~~~~~~~~~~~^^ File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/reader.py", line 784, in handle1 self.do_cmd(cmd) ~~~~~~~~~~~^^^^^ File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/reader.py", line 709, in do_cmd command.do() ~~~~~~~~~~^^ File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/commands.py", line 154, in do self.kill_range(r.pos, eol) ~~~~~~~~~~~~~~~^^^^^^^^^^^^ File "/usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_pyrepl/commands.py", line 71, in kill_range r.kill_ring[-1] = r.kill_ring[-1] + text ~~~~~~~~~~~^^^^ IndexError: list index out of range
IRC figured it out!
cchianel │ razzi, might be one of these three: https://github.com/pypy/pyrepl/blob/ca192a80b76700118b9bfd261a3d098b92ccfc31/pyrepl/commands.py#L140-L156 │ 074ABBMFF │15:41:25 gAy_Dragon │ SirDonNick: https://en.wikipedia.org/wiki/Control_character may be of use? │15:41:40 cchianel │ if arg is ever 0, last command is a subclass of the delete-to-end-of-line, but that ring is never appended to │15:42:38 cchianel │ GOT IT! │15:42:39 <-- │ minecraftchest1 ([email protected]) has quit (Quit: minecraftchest1) │15:42:39 -- │ minecraftchest2 is now known as minecraftchest1 │15:42:51 cchianel │ Ctrl-W + Ctrl-K │15:43:06 cchianel │ Ctrl-W = delete backwards │15:43:16 cchianel │ Ctrl-K = Delete to end of line │15:43:27 cchianel │ Do this on an empty line to reproduce │15:43:38 akk │ Ctrl-W is delete *word* backwards │15:43:57 SnoopJ │ and ^H is one char │15:44:01 akk │ right │15:44:11 SirDonNick │ Dragon: Thanks. (Just as I started mumbling “now I know why old-timers never left home without their IBM ‶yellow card.″”) │15:44:29 gAy_Dragon │ I checked man-ascii │15:44:32 SnoopJ │ I would guess that 'kill' probably refers to line-kill to the beginning or end of the line │15:44:33 akk │ and ^U is either delete from current point to beginning of line, or delete whole line, depending on the app │15:44:36 cchianel │ ^H does not reproducer │15:44:37 gAy_Dragon │ ^W kills me. │15:44:39 --> │ user69 (realname) ([email protected]) has joined #python │15:44:43 gAy_Dragon │ because I use it a LOT │15:44:49 gAy_Dragon │ and then! │15:44:53 gAy_Dragon │ I use firefox │15:44:55 gAy_Dragon │ and curse loudly │15:45:05 grym │ uh huh │15:45:05 gAy_Dragon │ (^w closes tabs) │15:45:06 --> │ Left_Turn [Left_Turn] (realname) (~Matthew@2a00:23c8:5f85:3301:9407:8d8f:d36f:4b9a) has joined #python │15:45:09 <-- │ jiffe ([email protected]) has quit (Ping timeout: 252 seconds) │15:45:17 cchianel │ So does the issue go to pyrepl or CPython? │15:45:19 <-- │ boomboxnation ([email protected]) has quit (Read error: Connection reset by peer) │15:45:50 akk │ gAy_Dragon: About a year ago firefox FINALLY stopped hardcoding ^W to be close window, and now it deletes the last word at least if you have the │ │ appropriate gtk emacs binding settings │15:45:51 <-- │ Guest0 (~Guest0@2a02:2a40:52e1:f700:3c49:29e4:321f:2095) has quit (Quit: Client closed) │15:46:12 akk │ gAy_Dragon: that was my #1 gripe about firefox, how they kept making it harder to override their hardwired ^W │15:46:27 gAy_Dragon │ cchianel: whats the actual issue? │15:46:29 <-- │ infernix ([email protected]) has quit (Quit: ZNC - http://znc.sourceforge.net) │15:46:33 gAy_Dragon │ is it that readline misbehaves? │15:46:42 <-- │ Blankspace (~Blankspac@user/blankspace) has quit (Quit: Client closed) │15:46:45 SirDonNick │ And ^D kills a certain repl I can't admit to using without inviting scorn. (Well, scorn above my usual background baseline.) │15:46:50 cchianel │ gAy_Dragon, ^W^K crashes CPython │15:46:55 --> │ minecraftchest2 [minecraftchest1] (minecraftchest1) ([email protected]) has joined #python │15:46:57 cchianel │ in REPL │15:47:04 razzi │ Wow great detective work cchianel !!
And IRC in its full color glory