[issue30431] input function truncates prompt by NULL byte

2017-05-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If stdin and stdout are attached to a terminal, input() uses the readline library (if it is available) for displaying the prompt and reading user input. This is the limitation of the readline library and Python C API that this works with null-terminated C

[issue30431] input function truncates prompt by NULL byte

2017-05-27 Thread Eryk Sun
Eryk Sun added the comment: The solution to raise a ValueError for the PyOS_Readline case won't change the behavior of input() in cases where the prompt is written to sys.stdout. As to copying what print() would do, I guess it's possible to fake it for common platforms. You'd have to process

[issue30431] input function truncates prompt by NULL byte

2017-05-27 Thread Terry J. Reedy
Terry J. Reedy added the comment: As near as I can tell, the patch introduces a regression. The doc for input(prompt) says "If the prompt argument is present, it is written to standard output without a trailing newline." The handling of the prompt is up to stdout.write and thence physical

[issue30431] input function truncates prompt by NULL byte

2017-05-27 Thread Terry J. Reedy
Terry J. Reedy added the comment: Experiments running 3.6.1 on Windows in console: >python -c "print('some\0 text') some text # \0 printed as ' ', as determined by # >python -c "for c in 'some text': print(ord(c))" printing 32 32 >python -c "input('some\0 text') some In IDLE, both print

[issue30431] input function truncates prompt by NULL byte

2017-05-23 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka stage: -> patch review versions: -Python 3.3, Python 3.4, Python 3.5 ___ Python tracker

[issue30431] input function truncates prompt by NULL byte

2017-05-22 Thread Kushal Das
Changes by Kushal Das : -- pull_requests: +1828 ___ Python tracker ___ ___

[issue30431] input function truncates prompt by NULL byte

2017-05-22 Thread Eryk Sun
Eryk Sun added the comment: PyOS_Readline uses a null-terminated prompt string. So input() needs to raise a ValueError if the prompt contains null characters, e.g. if PyBytes_GET_SIZE(po) != strlen(promptstr). -- nosy: +eryksun ___ Python tracker

[issue30431] input function truncates prompt by NULL byte

2017-05-22 Thread Kushal Das
Kushal Das added the comment: I am picking this up. -- assignee: -> kushal.das ___ Python tracker ___ ___

[issue30431] input function truncates prompt by NULL byte

2017-05-22 Thread Kushal Das
Changes by Kushal Das : -- nosy: +kushal.das ___ Python tracker ___ ___ Python-bugs-list

[issue30431] input function truncates prompt by NULL byte

2017-05-22 Thread Костя Чолак
New submission from Костя Чолак: input('some\x00 text') will prompt for `some` instead of `some text` -- components: IO messages: 294153 nosy: Костя Чолак priority: normal severity: normal status: open title: input function truncates prompt by NULL byte type: behavior versions: Python