[issue44762] getpass.getpass on Windows fallback detection is bad

Eryk Sun report at bugs.python.org
Thu Jul 29 15:14:24 EDT 2021


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

It should be noted that changing win_getpass() to check sys.stdin.isatty() makes it inconsistent with unix_getpass(). The latter tries to open "/dev/tty" regardless of sys.stdin. To be consistent, win_getpass() would be implemented to call fallback_getpass() only if "CONIN$" is inaccessible. 

We'd still have the problem that's reported here. A classic console session (not ConPTY) can have no window, or an invisible window, and thus no way for a user to enter text. I don't see any reports that reading from "/dev/tty" makes getpass() wait forever in POSIX, so this situation is probably unique to Windows, or at least it's far more likely in Windows, which may justify introducing an inconsistency.

----------

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


More information about the Python-bugs-list mailing list