mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
Avoid matching '' or 'yn' when asking for 'y' or 'n' in interactive code
This commit is contained in:
parent
becf1c5857
commit
1cbd2ab404
2 changed files with 2 additions and 2 deletions
|
|
@ -178,7 +178,7 @@ def send_metadata(self):
|
|||
'will be faster.\n(the login will be stored in %s)',
|
||||
get_pypirc_path())
|
||||
choice = 'X'
|
||||
while choice.lower() not in 'yn':
|
||||
while choice.lower() not in ('y', 'n'):
|
||||
choice = input('Save your login (y/N)?')
|
||||
if not choice:
|
||||
choice = 'n'
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ def ask_yn(question, default=None, helptext=None):
|
|||
question += ' (y/n)'
|
||||
while True:
|
||||
answer = ask(question, default, helptext, required=True)
|
||||
if answer and answer[0].lower() in 'yn':
|
||||
if answer and answer[0].lower() in ('y', 'n'):
|
||||
return answer[0].lower()
|
||||
|
||||
print('\nERROR: You must select "Y" or "N".\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue