1616
1717The :mod: `getpass ` module provides two functions:
1818
19- .. function :: getpass(prompt='Password: ', stream=None)
19+ .. function :: getpass(prompt='Password: ', stream=None, *, echo_char=None )
2020
2121 Prompt the user for a password without echoing. The user is prompted using
2222 the string *prompt *, which defaults to ``'Password: ' ``. On Unix, the
@@ -25,6 +25,12 @@ The :mod:`getpass` module provides two functions:
2525 (:file: `/dev/tty `) or if that is unavailable to ``sys.stderr `` (this
2626 argument is ignored on Windows).
2727
28+ The *echo_char * argument controls how user input is displayed while typing.
29+ If *echo_char * is ``None `` (default), input remains hidden. Otherwise,
30+ *echo_char * must be a printable ASCII string and each typed character
31+ is replaced by it. For example, ``echo_char='*' `` will display
32+ asterisks instead of the actual input.
33+
2834 If echo free input is unavailable getpass() falls back to printing
2935 a warning message to *stream * and reading from ``sys.stdin `` and
3036 issuing a :exc: `GetPassWarning `.
@@ -33,6 +39,9 @@ The :mod:`getpass` module provides two functions:
3339 If you call getpass from within IDLE, the input may be done in the
3440 terminal you launched IDLE from rather than the idle window itself.
3541
42+ .. versionchanged :: next
43+ Added the *echo_char * parameter for keyboard feedback.
44+
3645.. exception :: GetPassWarning
3746
3847 A :exc: `UserWarning ` subclass issued when password input may be echoed.
0 commit comments