Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-77065: Add optional keyword-only argumentecho_char
forgetpass.getpass
#130496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
donBarbos commentedFeb 27, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@picnixz sorry for choosing you, I just haven't found anyone else from the core team who is active yet (I looked at who is involved in issue and experts table). could you review? |
You can ping me for anything that is remotely related to security and cryptography |
picnixz left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Amask
is something else for me. So I would either name it "echochar" or "maskchar" or "hidechar", at least with some "char" inside it.
In addition, for termios, you should useECHOE
to handle ERASE
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz I chose |
Because if you were to use it, you would write |
Usually, you expect 1 character indeed. I don't think we should write something else than 1 char (or maybe we do but it's because of colors?) I would not expectwords to be put as placeholders. Maybe colorized characters, which in this case are allowed to be strings of length > 1, but not real words. Also, what we are echoing is really the corresponding passwordcharacter. Foreach character, we use that placeholder. |
I have made the requested changes; please review again |
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
mask
forgetpass.getpass
echochar
forgetpass.getpass
donBarbos commentedMar 1, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@picnixz I just thought maybe we also should to add |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
@picnixz, I added test cases, what do you think about them? |
picnixz left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can we have tests where we exercise control characters? this is quite important because we want to get the correct feedback
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
I added test case with control chars |
cc@picnixz |
@picnixz It seems that all the tests that you requested already exist, but maybe it will be possible to add more since there is already an issue for covering the module with tests I would like to have time to accept before feature freeze :-) |
picnixz commentedMay 4, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I am travelling (I'm back after the beta release) so I won't merge anything on mobile. I'll defer this to@gpshead, sorry but it passed under my radar :( (in the future, a request for review is more likely to be noticed) |
Lib/getpass.py Outdated
@@ -151,6 +176,42 @@ def _raw_input(prompt="", stream=None, input=None): | |||
return line | |||
def _input_with_echochar(prompt, stream, input, echochar): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
rather than duplicating so much of _raw_input's logic, I suggest making a _readline_with_echochar() function and just conditionally calling that vs the existing input.readline() call within _raw_input().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
sounds reasonable, please check my diff
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
echochar
forgetpass.getpass
echo_char
forgetpass.getpass
bf8bbe9
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thank you everyone! |
Uh oh!
There was an error while loading.Please reload this page.
📚 Documentation preview 📚:https://cpython-previews--130496.org.readthedocs.build/