Is your feature request related to a problem? Please describe.
Had pymanager uninstall <tag> in my terminal and in a dumb panic on my split keyboard, submitted the characters yhn:
pymanager uninstall 3.13.11
Uninstall Python 3.13.11? [Y/n] yhn
Expected to cancel/break since yhn does not match a provided option - y or n.
In actuality, it proceeded to remove that python installation.
Describe the solution you'd like
Literally match for the submitted character y or n.
Describe alternatives you've considered
Not panicking and hitting n (or hitting anything else really, as long as it does not start with y)
Additional context
Was a silly mistake that costed me enough rebuild time that I came back just to figure out why it happened.
https://github.com/python/pymanager/blob/main/src/manage/commands.py#L624
|
def _ask(self, fmt, *args, yn_text="Y/n", expect_char="y"): |
|
if not self.confirm: |
|
return True |
|
if not LOGGER.would_print(): |
|
LOGGER.warn("Cannot prompt for confirmation at this logging level. " |
|
"Pass --yes to accept the default response.") |
|
if not LOGGER.would_log_to_console(logging.WARN): |
|
sys.exit(1) |
|
return False |
|
LOGGER.print(f"{fmt} [{yn_text}] ", *args, end="") |
|
try: |
|
resp = input().casefold() |
|
except Exception: |
|
return False |
|
return not resp or resp.startswith(expect_char.casefold()) |
Since we match via startswith, it does not matter what the remaining characters are - as long as expect_char is the first char, then _ask evaluates.
Is your feature request related to a problem? Please describe.
Had
pymanager uninstall <tag>in my terminal and in a dumb panic on my split keyboard, submitted the charactersyhn:Expected to cancel/break since
yhndoes not match a provided option -yorn.In actuality, it proceeded to remove that python installation.
Describe the solution you'd like
Literally match for the submitted character
yorn.Describe alternatives you've considered
Not panicking and hitting
n(or hitting anything else really, as long as it does not start withy)Additional context
Was a silly mistake that costed me enough rebuild time that I came back just to figure out why it happened.
https://github.com/python/pymanager/blob/main/src/manage/commands.py#L624
pymanager/src/manage/commands.py
Lines 610 to 624 in 682d0f8
Since we match via
startswith, it does not matter what the remaining characters are - as long asexpect_charis the first char, then_askevaluates.