behavior of KeyboardInterrupt?
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
調査の方向性
Issue に示されている PythonPlot、while true ループ、プロット呼び出しを使って Windows Ctrl-C の動作を再現します。src/pygui.jl:199 から開始し、PythonCall と tkinter のタイマースタックを調査して、結果を GR バックエンドと比較します。Julia の計算を中断しても、その後の PythonPlot 呼び出しが壊れなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
During an interactive session where I am variously running computations and plotting things, when I try to keyboard interrupt a running computation, Python apparently gets interrupted instead; for example, notice what happens when I hit Ctrl-C during a while true block:
julia> using PythonPlot
julia> plot(range(0, 1, 101).^2)
Python: [<matplotlib.lines.Line2D object at 0x0000022445A5FF50>]
julia> while true # surrogate for some long computation that I decide I want to interrupt
5+2
sleep(0.1)
end
Error in Timer:
Python: KeyboardInterrupt:
Python stacktrace:
[1] __getattr__
@ tkinter C:\Users\zor_q\.julia\environments\v1.9\.CondaPkg\env\Lib\tkinter\__init__.py:2408
Stacktrace:
[1] pythrow()
@ PythonCall C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\err.jl:94
[2] errcheck
@ C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\err.jl:10 [inlined]
[3] pygetattr(x::PythonCall.Py, k::String)
@ PythonCall C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\abstract\object.jl:60
[4] getproperty(x::PythonCall.Py, k::Symbol)
@ PythonCall C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\Py.jl:261
[5] (::PythonPlot.var"#9#10"{PythonCall.Py, PythonCall.Py, PythonCall.Py})(async::Timer)
@ PythonPlot C:\Users\zor_q\.julia\packages\PythonPlot\f591M\src\pygui.jl:199
[6] macro expansion
@ .\asyncevent.jl:281 [inlined]
[7] (::Base.var"#702#703"{PythonPlot.var"#9#10"{PythonCall.Py, PythonCall.Py, PythonCall.Py}, Timer})()
@ Base .\task.jl:134
Meanwhile, the while true block continues running. If it were a computation that came to an end at some point, all future plotting would fail (I assume because the background Python process is no longer running?).
Is this the expected behavior? I would have hoped that the execution of the while true block would have been interrupted and Python would have been left alone.
For comparison, when using GR, it's the while true block that gets interrupted:
julia> using Plots # default backend is GR
julia> plot(range(0, 1, 101).^2) # plot window pops up
julia> while true # surrogate for long computation that I decide I want to interrupt
5+2
sleep(0.1)
end
ERROR: InterruptException:
Stacktrace:
[1] poptask(W::Base.IntrusiveLinkedListSynchronized{Task})
@ Base .\task.jl:974
[2] wait()
@ Base .\task.jl:983
[3] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
@ Base .\condition.jl:130
[4] wait
@ .\condition.jl:125 [inlined]
[5] _trywait(t::Timer)
@ Base .\asyncevent.jl:138
[6] wait
@ .\asyncevent.jl:155 [inlined]
[7] sleep
@ .\asyncevent.jl:240 [inlined]
[8] top-level scope
@ .\REPL[3]:3
julia> plot(range(0, 1, 101).^2) # still plots successfully
julia> backend()
Plots.GRBackend()
- 主要言語
- Julia
- スター
- 85
- フォーク
- 9
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaPy/PythonPlot.jl のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
JuliaPy/PythonPlot.jl#55 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
JuliaPy/PythonPlot.jl#54 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
JuliaPy/PythonPlot.jl#53 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
JuliaPy/PythonPlot.jl#52 · リアクション 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
JuliaPy/PythonPlot.jl#51 ·
JuliaPy/PythonPlot.jl の issue をすべて見る
似ている issue
-
broken links in docsオープン
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
JuliaPhysics/BeamletOptics.jl#127 ·
メンテナーはふだん 1 日以内に返信
-
Chains resumed from `initial_state` take `num_warmup + 1` warm-up steps対応中かも @thevolatilebit が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
TuringLang/AbstractMCMC.jl#220 ·
-
found-by-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
exanauts/SparseDirectSolver.jl#92 ·
メンテナーはふだん 1 日以内に返信
-
`inv` of a dense matrix fails for arrays whose `parent` is not an array of the same kind対応中かも @devmotion が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
JuliaLang/LinearAlgebra.jl#1740 ·
メンテナーはふだん 2 日以内に返信