Message285103
Trying to track the 'char * text' pointer that is returned to Python by readline in rlhandler() and using gdb 'set follow-fork-mode child' and 'set detach-on-fork off' to stop (with a breakpoint in rlhandler) in the child spawned by run_pty() in test_nonascii, unfortunately this fails with gdb crashing in a debug session on Android. So I use the attached readline.patch with good old printf instead. The results:
(1) UTF-8 locale:
command: LANG=en_US.UTF-8 python -m test -v -m test_nonascii test_readline
stderr output:
char *text: "[ïnserted]|tëxt[after]"
(2) C locale
command: python -m test -v -m test_nonascii test_readline
stderr output:
char *text: "[ïnsexrted]|t"
(3) C locale and a change in 'script' to not use "\xEB" in 'macro':
s/macro = "|t\xEB[after]"/macro = "|te[after]"/
command: python -m test -v -m test_nonascii test_readline
stderr output:
char *text: "[ïnserted]|tex[after]"
Case (2) confirms your comment in msg283544: "the Ctrl+A macro seems to have only inserted the two ASCII characters "|t" and has stopped at the non-ASCII character "\xEB".
So readline with the C locale on Android:
* Accepts eight-bits characters in rl_pre_input_hook().
* Discards all the characters after the first eight-bits character in macro expansion.
* Discards eight-bits characters on input.
It seems reasonable to consider that readline is broken with the C locale on Android and to skip the test in that case whether using your last patch Martin, or when test.support.is_android is True.
I don't know if this is relevant, but on archlinux (not on debian), when I run bash and therefore readline, with the C locale (on xterm or on the linux console, using my french keyboard) I have the following results:
[xavier@bilboquet ~]$ LANG= bash
[xavier@bilboquet ~]$ # first prompt
bash: $'\303': command not found
[xavier@bilboquet ~]$ A # second prompt
bash: $'\303A\251': command not found
[xavier@bilboquet # third prompt
[xavier@bilboquet ~]$
On the first prompt I type 'é' followed by the <backspace> key and the <return> key.
On the second prompt I type 'é' followed by <left-arrow>, followed by 'A' and <return>.
On the third prompt I type 4 times 'é' followed by 8 times <backspace> and <return>, note how the prompt has been eaten by the backspaces. |
|
Date |
User |
Action |
Args |
2017-01-10 10:15:21 | xdegaye | set | recipients:
+ xdegaye, martin.panter |
2017-01-10 10:15:21 | xdegaye | set | messageid: <1484043321.18.0.342964146119.issue28997@psf.upfronthosting.co.za> |
2017-01-10 10:15:21 | xdegaye | link | issue28997 messages |
2017-01-10 10:15:19 | xdegaye | create | |
|