`logging.shutdown()` should clear `logging._handlerList` if that's what it's called with
Nessuno ha ancora preso questa issue.
- #129681 di @cjw296 — chiusa senza merge
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Bug description:
In the wild, I've encountered situations where logging.shutdown gets called more than once in a process.
The current implementation is called with logging._handlerList by default, meaning that handlers can have their flush() and close() methods called more than once, which can cause bad things to happen if those handlers are not amenable to being closed more than once.
If logging.shutdown() is processing logging._handlerList, it should clear that list once it finished to prevent handlers having their flush() and close() methods called more than once.
CPython versions tested on:
3.12, CPython main branch
Operating systems tested on:
Linux, macOS
Linked PRs
- gh-129681
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 dal punto di ingresso logging.shutdown() ed esamina come elabora logging._handlerList, incluse le chiamate ripetute a flush() e close() descritte nel report. Conferma che shutdown svuoti l’elenco predefinito degli handler dopo averlo elaborato e verifica che chiamate ripetute a shutdown non elaborino nuovamente gli stessi handler.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100