classification
Title: getpass.getpass not working with on windows when ctrl+v is used to enter the string
Type: behavior Stage:
Components: Documentation Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Atul Bagga, docs@python, eryksun, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2019-06-27 09:49 by Atul Bagga, last changed 2019-07-02 10:04 by Atul Bagga.

Messages (4)
msg346721 - (view) Author: Atul Bagga (Atul Bagga) Date: 2019-06-27 09:49
Detailed issue filed here - https://github.com/microsoft/knack/issues/160
msg346727 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2019-06-27 11:00
getpass() reads from the console via msvcrt.getwch(). This is a raw console read, so Ctrl+V is read as the SYN (0x16) control character. Only the following keys are handled specially by getpass: 

* Ctrl+C - raise KeyboardInterrupt
* Ctrl+H (backspace) - delete the previous character
* Ctrl+J (linefeed) and Ctrl+M (return) - return

getpass() behaves pretty much the same in a Linux terminal emulator, except Ctrl+H isn't backspace. 

Recent versions of the console host in Windows 10 have an option to support pasting via Ctrl+Shift+V, regardless of the input mode. This is pretty common in Unix terminal emulators as well. You can change this setting in the Properties->Options dialog for a particular window or shortcut, or the default setting in the Defaults->Options dialog. In the "HKCU\Console" registry key, the DWORD value name is "InterceptCopyPaste".
msg346867 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-28 21:19
If anything, this seems to be a getpass doc issue.
msg347126 - (view) Author: Atul Bagga (Atul Bagga) Date: 2019-07-02 10:04
Suprisingly this works fine on ConEMU which I commonly use on windows though internally I still use powershell on conemu. 
https://conemu.github.io/

It does not work on CMD and Powershell consoles.
History
Date User Action Args
2019-07-02 10:04:03Atul Baggasetmessages: + msg347126
2019-06-28 21:19:47terry.reedysetnosy: + terry.reedy, docs@python
messages: + msg346867

assignee: docs@python
components: + Documentation, - Library (Lib), Windows
2019-06-27 11:00:55eryksunsetnosy: + eryksun
messages: + msg346727
2019-06-27 10:32:50xtreaksetnosy: + tim.golden, steve.dower, zach.ware, paul.moore
components: + Windows
2019-06-27 09:49:37Atul Baggacreate