`datetime.strptime` accepts incompatible arguments
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Bug description:
If you over-specify a datetime strptime string, it seems that datetime.strptime when encountering a component that has been specified twice, will overwrite earlier values with more recent ones.
>>> datetime.strptime("200099", "%Y%y")
datetime.datetime(1999, 1, 1, 0, 0)
One approach would be to ban over-specified formats, but that would be a problem for someone who wants to, use a format like "%M %B" (e.g. something sortable by month number while also showing month name), so I think we don't want to do that.
Alternatively we could start raising an exception if you get different values from these two things, or possibly a warning.
Or we can just accept that if you use a weird format you should expect weird behavior.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-125009
- gh-132524
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dall’implementazione di datetime.strptime ed esamina le PR collegate gh-125009 e gh-132524 per conoscere la direzione attuale e i test correlati. Determina se i campi ripetuti in conflitto debbano generare un errore, emettere un avviso o rimanere accettati; il lavoro è concluso quando il comportamento e i test riflettono una policy decisa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100