Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Segfault when plotting to axis of closed figure

Offen
#28 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
julia, matplotlib, python

Rechercherichtung

Beginne damit, das Szenario mit einer geschlossenen Figure mit PythonPlot v1.0.2 und dem Julia-Beispiel aus dem Issue zu reproduzieren. Untersuche anschließend die Behandlung der PythonPlot-GUI bei src/pygui.jl Zeile 199 sowie den im Trace gezeigten matplotlib/Tk-Stack. Als erledigt gilt die Änderung, wenn das Plotten in eine geschlossene Figure keinen Segmentation Fault mehr verursacht, sondern sich stattdessen sicher verhält, idealerweise indem ein Fehler ausgelöst wird, falls die Operation nicht unterstützt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

If we attempt to plot to the axis of a figure that has already been displayed and closed, then on my machine Juliaa segfaults.

julia> fig, ax = subplots()  # opens plot window, leave open
Python: (<Figure size 640x480 with 1 Axes>, <Axes: >)

julia> ax.scatter(randn(10), randn(10))  # adds plot to window
Python: <matplotlib.collections.PathCollection object at 0x7f0df059df50>

Then close the opened plot window and run the following, which causes the segfault.

julia> ax.scatter(randn(10), randn(10))
Python: <matplotlib.collections.PathCollection object at 0x7f0df19db050>

julia> 
[306116] signal (11.1): Segmentation fault
in expression starting at none:0
Tk_GetImageMasterData at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtk8.6.so (unknown line)
Tk_FindPhoto at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtk8.6.so (unknown line)
_ZL11mpl_tk_blitP7_objectS0_ at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/site-packages/matplotlib/backends/_tkagg.cpython-311-x86_64-linux-gnu.so (unknown line)
cfunction_call at /usr/local/src/conda/python-3.11.4/Objects/methodobject.c:553
_PyObject_MakeTpCall at /usr/local/src/conda/python-3.11.4/Objects/call.c:214
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:4774
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393
PythonCmd at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:2252
TclNRRunCallbacks at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
Tkapp_Call at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:1462
method_vectorcall_VARARGS at /usr/local/src/conda/python-3.11.4/Objects/descrobject.c:330
_PyObject_VectorcallTstate at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_call.h:92 [inlined]
PyObject_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:299
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:4774
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393
do_call_core at /usr/local/src/conda/python-3.11.4/Python/ceval.c:7357 [inlined]
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:5381
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393
do_call_core at /usr/local/src/conda/python-3.11.4/Python/ceval.c:7357 [inlined]
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:5381
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393 [inlined]
_PyObject_VectorcallTstate at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_call.h:92
method_vectorcall at /usr/local/src/conda/python-3.11.4/Objects/classobject.c:67
PythonCmd at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:2252
TclNRRunCallbacks at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
AfterProc at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
TclServiceIdle at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
Tcl_DoOneEvent at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
_tkinter_tkapp_dooneevent_impl at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:2785 [inlined]
_tkinter_tkapp_dooneevent at /usr/local/src/conda/python-3.11.4/Modules/clinic/_tkinter.c.h:566
cfunction_vectorcall_FASTCALL at /usr/local/src/conda/python-3.11.4/Objects/methodobject.c:427
PyObject_CallObject at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/cpython/pointers.jl:299 [inlined]
macro expansion at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/Py.jl:131 [inlined]
pycallargs at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:210
unknown function (ip: 0x7f4b801c1ea6)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
#pycall#59 at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:228
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
do_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/builtins.c:730
pycall at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:218
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
do_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/builtins.c:730
#_#11 at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/Py.jl:341
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
do_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/builtins.c:730
Py at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/Py.jl:341
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
#9 at /home/sethaxen/.julia/packages/PythonPlot/f591M/src/pygui.jl:199
macro expansion at ./asyncevent.jl:281 [inlined]
#702 at ./task.jl:134
unknown function (ip: 0x7f4b801d59df)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
start_task at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/task.c:1092
Allocations: 10747647 (Pool: 10739903; Big: 7744); GC: 15
Segmentation fault (core dumped)

If plotting to this axis is not supported, it would be much better to throw an error.

Environment

julia> versioninfo()
Julia Version 1.9.2
Commit e4ee485e909 (2023-07-05 09:39 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake)
  Threads: 8 on 8 virtual cores
Environment:
  JULIA_CMDSTAN_HOME = /home/sethaxen/software/cmdstan/2.30.1/
  JULIA_NUM_THREADS = auto
  JULIA_EDITOR = code

(jl_jbDJBf) pkg> st
Status `/tmp/jl_jbDJBf/Project.toml`
  [274fc56d] PythonPlot v1.0.2
Vorherrschende Sprache
Julia
Sterne
85
Forks
9
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus JuliaPy/PythonPlot.jl

Alle Issues in JuliaPy/PythonPlot.jl

Ähnliche Issues

Weitere Issues zu Julia

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.