`select.BaseSelector.select` do not conform to documentation with regard to signal handling
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Bug description:
According to documentation in https://docs.python.org/3/library/selectors.html#selectors.BaseSelector.select:
.. versionchanged:: 3.5
The selector is now retried with a recomputed timeout when interrupted
by a signal if the signal handler did not raise an exception (see
:pep:`475` for the rationale), instead of returning an empty list
of events before the timeout.
However, as of writing this issue, selectors.SelectSelector.select and co can't differentiate between InterruptedError and timeout, as this exceptions is caught in in those methods.
While select.select shouldn't raise InterruptedError, such exception could be raised in a signal handler, therefore causing selectors.SelectSelector.select to return an empty list (instead of the raised exception), as-if it was a timeout.
The behaviour that I would expect has been implemented in https://github.com/python/cpython/commit/f70e1ca0fc30426d12aa8fc6684764ee11a66777, however it has been reverted in a following commit https://github.com/python/cpython/commit/90ecfe65e68#diff-671465c62a2c7c951b397550dc8f2f1c03860af4c089299e6edea29347cf6018 . It is unclear to me if it is an oversight, or if this revert was expected.
I only tested this for selectors.SelectSelector, but looking at the sources, I would expect the same behaviour exist for all select.*Selector classes
CPython versions tested on:
3.12, CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-120002
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 con selectors.SelectSelector.select e confronta la sua gestione delle interruzioni dei segnali con il comportamento documentato di BaseSelector.select. Esamina la PR collegata gh-120002 e i commit referenziati per comprendere la risoluzione prevista, quindi verifica se le classi select.*Selector necessitano di un trattamento coerente e di una copertura delle regressioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100