python / python/pymanager

Explicitly require Y/N for Command._ask

Aperta
#244 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Python
Stelle
344
Fork
74
Merge medio
1g 3h
PR unite (30g)
7

Descrizione

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

https://github.com/python/pymanager/blob/682d0f87a0eadb3e137b065cda0b3a74d8e83fa2/src/manage/commands.py#L610-L624

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da src/manage/commands.py intorno alle righe 610-624, in particolare dal punto di ingresso Command._ask e dalla logica del prompt collegata. Verifica che un input come yhn venga rifiutato anziché essere trattato come y, mentre le risposte Y/N previste mantengano il comportamento atteso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
cli
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.