Subtle output flushing issue in Python 3.4
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza con la invocación del subproceso check_pyflakes indicada y compara cómo Pyflakes escribe stdout y stderr intercalados en Python 3.4. Usa el commit del workaround de Zulip 6de77db93fe20d747541309d952035f070a157f para reproducir el fallo del filtrado e identificar el punto de entrada relevante de Pyflakes. El trabajo está terminado cuando las líneas de salida permanecen correctamente separadas al consumirse a través de una tubería de stdout/stderr combinados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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!
- Lenguaje dominante
- Python
- Estrellas
- 1.5k
- Forks
- 205
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 5
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PyCQA/pyflakes
-
F542 is not a crimeAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
setuptools deprecation warningsAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 52/100
-
Use of await in a function that is not async should be shown as a syntax error by flake8Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de PyCQA/pyflakes
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
micropython/micropython#19906 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
FinanceFlash/unvibecode#597 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
TomAnthony/YourOwnWeigh#21 ·
Los mantenedores suelen responder en 1 día
-
[BUG]: Compliance rules never see Unity Catalog views as viewsPosiblemente ocupada @wagnercsantos la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
databrickslabs/ontos#1348 ·
Los mantenedores suelen responder en 3 días
-
Deprecated datetime.utcnow() is called on every log line (DeprecationWarning on Python 3.12+)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días