behavior of KeyboardInterrupt?
還沒有人認領這個 Issue。
評估
- 難度
- 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 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 20/100
JuliaPy/PythonPlot.jl#51 ·
查看 JuliaPy/PythonPlot.jl 的全部 Issue
相似的 Issue
-
tagbot-manual
難度 1/5 1 小時以內 新手友好度 75/100
tshort/StaticCompiler.jl#191 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
SciML/SciMLSensitivity.jl#1703 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
JuliaGPU/GPUCompiler.jl#1008 ·
維護者通常 1 天內回覆
-
`biggs6` disagrees with CUTEst and is unbounded below可能已有人在做 @timholy 於 1 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 68/100
-
Cannot set point coordinates with `Range`s (or arbitrary arrays) using `Makie.Resampler` in `heatmap`可能已有人在做 @ffreyer 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆