Martin Panter added the comment:

I think Victor may be on the right track. Since the macro contains two 
newlines, a single call to rl_callback_read_char() is going to produce two 
calls back to the rl_callback_handler_install() handler to receive each line.

I can make the example from the Readline documentation 
<https://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC43> crash the 
same way that Python does. First, add a macro to ~/.inputrc, which causes an 
exclamation mark (!) to enter two lines at once:

"!": "exit\ncrash\n"

Now, typing an exclamation mark will cause the example program (and Python!) to 
crash.

In the description of rl_callback_read_char() 
<https://cnswww.cns.cwru.edu/php/chet/readline/readline.html#IDX335>, it says 
“If the ‘lhandler’ function returns . . .”. That seems to be hinting at using 
something like setjmp() to avoid the function returning, which might help, but 
I am not sure.

----------
nosy: +martin.panter

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25259>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to