Subtle output flushing issue in Python 3.4
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con l’invocazione segnalata del sottoprocesso check_pyflakes e confronta il modo in cui Pyflakes scrive stdout e stderr intercalati in Python 3.4. Usa il commit della soluzione alternativa di Zulip 6de77db93fe20d747541309d952035f070a157f per riprodurre il malfunzionamento del filtraggio e identificare il punto di ingresso rilevante di Pyflakes. Il lavoro è completato quando le righe di output rimangono correttamente separate se consumate tramite una pipe stdout/stderr unificata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I just tracked down and annoying behavior change that we got in using Pyflakes when we upgraded from Python 2 to Python 3 in the Zulip project. It's related to interleaving stdout and stderr from pyflakes.
Basically we have a little pyflakes wrapper, check_pyflakes, that excludes certain warnings we're not interested in, by sending stdout and stderr to a pipe. It suddenly stopped filtering lines correctly when we switched to Python 3, because we were interleaving the stdout/stderr output from pyflakes, and apparently in Python 3, the newline characters in the pyflakes output got interleaved wrong, and so the filtering filtered the wrong thing. i.e. with code like p = subprocess.Pipe(["pyflakes", ...], stdout=subprocess.PIPE, stderr=subprocess.STDOUT); for ln in p.readlines(): print(p), you'll end up with lines of pyflakes output like this:
b"zproject/settings.py:95: 'from .prod_settings import *' used; unable to detect undefined nameszerver/views/users.py:49:39: invalid syntax\n"
(there should have been a \n in nameszerver).
Here's the commit I just merged into Zulip working around this issue, with details on the specifics: https://github.com/zulip/zulip/commit/6de77db93fe20d747541309d952035f070a157f6
Since I have found that needing to add a sys.stdout.flush() is a common type of new bug when switching to Python 3, I figured I'd report this, since I think the reason this stopped working is that Pyflakes needs such a statement added somewhere, and fixing this might save other folks moving to Python 3 some pain.
I'm happy to provide more details on how to reproduce, but I think it should be easy to do with the subprocess invocation that we have in the pre-6de77db9 world.
Thanks for a great tool, and I hope this report helps!
- Lingua principale
- Python
- Stelle
- 1.5k
- Fork
- 205
- Merge medio
- 1g 2h
- PR unite (30g)
- 5
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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.
Altre issue di PyCQA/pyflakes
-
F542 is not a crimeAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
-
Use of await in a function that is not async should be shown as a syntax error by flake8Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di PyCQA/pyflakes
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
micropython/micropython#19906 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
FinanceFlash/unvibecode#597 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
TomAnthony/YourOwnWeigh#21 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: Compliance rules never see Unity Catalog views as viewsForse già presa @wagnercsantos l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
databrickslabs/ontos#1348 ·
I maintainer di solito rispondono entro 3 giorni
-
Deprecated datetime.utcnow() is called on every log line (DeprecationWarning on Python 3.12+)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni