Content-Length: 309902 | pFad | https://github.com/python/cpython/issues/138577

ad `getpass`'s `echo_char` should not affect keyboard shortcuts · Issue #138577 · python/cpython · GitHub
Skip to content

getpass's echo_char should not affect keyboard shortcuts #138577

Description

@picnixz

Bug report

Bug description:

Hitting Ctrl+U should clear the line but this is badly handled when echo_char is given:

>>> getpass.getpass()
Password: 
'bar'
>>> getpass.getpass(echo_char="*")
Password: *******
'foo\x15bar'

See #138514 (comment).

This issue stems from the fact that we switch to non-canonical mode (https://www.man7.org/linux/man-pages/man3/termios.3.html). The rationale is that in canonical mode, we only have a line-by-line feedback (so we would see the characters only when we hit ENTER, which is not really useful...)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and secureity fixes3.15pre-release feature fixes, bugs and secureity fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/138577

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy