IDLE - there is no known way to trigger atexit functions
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Hello!
So this has been an issue that has probably been bugging many people for a while now. This has bitten me back when I was a newbie as well, learning python using IDLE. This issue does not personally affect me anymore since I've mostly moved on from IDLE, but for the sake of others new to the language, I would like to formalise this issue on the tracker.
Here is a pure python MRE that demonstrates what I'm saying
import atexit
import time
@atexit.register
def done():
print("Exiting application!")
time.sleep(1)
When I run this on the command-line with no flags, I see the text printed after the program runs for a second and exits. On IDLE, this just runs for a second and exits without printing anything.
So I later realised that IDLE runs programs with the -i flag. But on the commandline I can do a ctrl+z and get the interpreter to actually stop and handle atexit. This is not apparent in IDLE shell, where there does not seem to be any distinction between the "regular interactive state", and the "previous module run interactive state". And neither does ctrl+c/z/d work. A hard shell restart also does not lead to anything being printed.
I've glanced through the issue tracker with a quick search and I didn't find a duplicate of this issue, but incase I'm mistaken, my apologies; this issue can be closed.
Your environment
- CPython versions tested on: 3.10 (but from my memory, it happened on all previous versions too)
- Operating system and architecture: Windows 11 64-bit (In my understanding it also happens on other architectures and OSes)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された pure-Python の atexit 再現プログラムを IDLE とコマンドラインから実行し、その後、IDLE シェルの通常の状態とモジュール実行後の状態を比較します。完了条件は、登録された atexit 関数を実行するインタープリター状態に到達する明確な方法を IDLE が提供し、報告された出力がモジュールの終了後に表示されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- desktop, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100