Print from background thread has broken line endings
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Bug report
Bug description:
I noticed that in python 3.13 (in linux), messages that were previously logged nicely to the console are now behaving as if the lines end like a windows line feed character without carriage return -- the cursor moves down a row, but not back to the beginning of the line. The example I chose below looks tame, but it makes most real logging output very difficult to read.
This only seems to happen for lines printed from background threads:
import threading, time
def msg():
print('this is line 1')
print('this is line 2')
time.sleep(0.1) # first few lines work as expected, but after a brief time, the problem begins
print('this is line 3')
print('this is line 4')
thread = threading.Thread(target=msg)
thread.start()
Running this code in python 3.13.1, interactive mode looks like:
$ python -i print_test.py
this is line 1
this is line 2
>>> this is line 3
this is line 4
>>>
Non-interactive looks fine:
$ python print_test.py
this is line 1
this is line 2
this is line 3
this is line 4
And interactive in 3.12.8 looks fine:
$ python -i print_test.py
this is line 1
this is line 2
>>> this is line 3
this is line 4
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Guía de contribución
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.
Línea de trabajo
Comienza ejecutando el script proporcionado en modo interactivo en Linux con Python 3.13 y, después, compara su salida con Python 3.12 y con el modo no interactivo. Investiga el manejo del prompt interactivo y de la salida del hilo en segundo plano; la tarea está terminada cuando las líneas del hilo en segundo plano devuelven el cursor al principio de cada línea sin interrumpir el prompt.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- cli
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 48/100