Print from background thread has broken line endings
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Linux 上で Python 3.13 を使用して提供されたスクリプトを対話モードで実行し、その後、その出力を Python 3.12 および非対話モードの出力と比較します。対話プロンプトとバックグラウンドスレッドの出力処理を調査してください。完了条件は、バックグラウンドスレッドの各行がプロンプトを乱すことなくカーソルを各行の先頭に戻すことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100