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

Terry J. Reedy report at bugs.python.org
Thu Aug 5 00:12:44 EDT 2021


Terry J. Reedy <tjreedy at udel.edu> added the comment:

The rationale for the __stdin__ and stdin check is this:  When python starts, both are usually set an io.TextIOWrapper wrapping a system console. (At least on Windows, both may instead be None instead.)  __stdin__ should never be altered.  Getpass.getpass knows how to turn off echo on a system terminal.  So if stdin is not None and is not __stdin__, stdin is very likely not a system terminal, and if so, getpass does not know to turn off echo, if indeed this is possible.

As far as I know, the tk and hence tkinter text widget do not come with a option to not display key presses that are stored in the widget.  An application would have to intercept keypresses and store them elsewhere.
But this is quite different issue.

This issue is not about echo, but about interactivity.  Testing that with isatty is *NOT* a substitute for testing whether an interactive device is the system terminal or not.  (IDLE's stdio connected to Shell passes isatty.)  Any new test would have to added without deleting the current test.

----------
nosy: +terry.reedy

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


More information about the Python-bugs-list mailing list