New submission from Markus Unterwaditzer:
getpass.getpass doesn't enter a newline when the user aborts input with ^C, while input/raw_input does.
This behavior is surprising and can lead to mis-formatting of subsequent output. However, since this behavior exists since 2.7 and applications may have started to rely on it, I'd add a note to the documentation.
assignee: docs@python components: Documentation messages: 247302 nosy: docs@python, untitaker priority: normal severity: normal status: open title: Document getpass.getpass behavior on ^C versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Irit Katriel email@example.com added the comment:
I don't see a difference between getpass and input in this respect:
try: getpass.getpass('getpass: ') except: pass print('goodbye getpass')
try: input('input: ') except: pass print('goodbye input')
If I run that script and ^C after each prompt, I get this:
python.bat x.py Running Release|x64 interpreter... getpass: goodbye getpass input: goodbye input
nosy: +iritkatriel resolution: -> works for me status: open -> pending