[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Merlijn van Deen
report at bugs.python.org
Sat Feb 26 16:59:08 CET 2011
Merlijn van Deen <valhallasw at gmail.com> added the comment:
No, I do not, for several reasons.
First of all, this is not a change *from* previous behaviour, but a change *back to* previous behaviour. And sensible behaviour, too.
Secondly, I have tested what getpass does on windows (Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32). There, I get a KeyboardInterrupt when pressing ctrl-c. So for the simple reason of having consistend cross-platform behaviour, either the linux or the windows implementation should change.
Thirdly, the reason for adding the ISIG flag was that it is 'a possible security hole' - but no-one actually mentions *what* that hole would be. As Guido notes (in that same thread!): "Sorry, but this just doesn't make sense. There are so many differences between C and Python that you can't just compare a C and a Python version of a function and pointing at the differences as possible security holes or bugs.".
Lastly, I see no reason to mimic POSIX behaviour per se. Why not use the POSIX getpass function in the first place, then?
By the way - even with ISIG on, it should be possible to support KeyboardInterrupts - just read per-character instead of per-line (cf. the windows getpass).
[1] http://mail.python.org/pipermail/python-dev/2003-December/040583.html
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11236>
_______________________________________
More information about the Python-bugs-list
mailing list