[issue37426] getpass.getpass not working with on windows when ctrl+v is used to enter the string

Eryk Sun report at bugs.python.org
Fri Feb 25 11:02:26 EST 2022


Eryk Sun <eryksun at gmail.com> added the comment:

> Clicking `Edit > Paste` from the window menu
> Use right-click to paste

In particular, if the console has quick-edit mode enabled, then you can paste text by right-clicking. Also, if text is selected in quick-edit mode, right-clicking copies to the clipboard.

> Enabling `Properties > Options > Use Ctrl+Shift+C/V as Copy/Paste` from the menu

I prefer this setting because it matches the behavior of terminals on other platforms. I suggest setting it in the "Defaults" dialog instead of "Properties". Otherwise, you'll have to configure it individually for each shell link (.LNK file) or session title. (The console session title defaults to the executable path, unless set in STARTUPINFO.)

> Using the new Windows Terminal

Terminal allows configuring the actions for keyboard shortcuts. By default it grabs Ctrl+C (copy) and Ctrl+V (paste). I disable these mappings. I leave the default mappings in place for Ctrl+Shift+C (copy), Ctrl+Shift+V (paste), Ctrl+Insert (copy), and Shift+Insert (paste).  

> This behavior is the same Command Prompt and PowerShell

The behavior has to be the same when the parent process is a normal console shell such as CMD or PowerShell. Python inherits its console session from the shell, and that's the extent of the shell's involvement. 

A console session is hosted by an instance of conhost.exe or openconsole.exe. If the host is running in pseudoconsole (headless) mode, then the user interface for the session is hosted by another application (e.g. Windows Terminal). Even in pseudoconsole mode, however, the console host a lot to do in order to manage the session state for the console API.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37426>
_______________________________________


More information about the Python-bugs-list mailing list