protect against Tk not having `_default_root` attr during event loop
I don't understand why this segfault is happening after the test suite finishes, but this should protect against it?
Test Summary: | Pass Total Time
Foofoofoooo.jl | 614 614 5m39.0s
signal (11): Segmentation fault
in expression starting at none:0
_PyInterpreterState_GET at /usr/local/src/conda/python-3.11.0/Include/internal/pycore_pystate.h:116 [inlined]
get_dict_state at /usr/local/src/conda/python-3.11.0/Objects/dictobject.c:251 [inlined]
new_dict at /usr/local/src/conda/python-3.11.0/Objects/dictobject.c:722 [inlined]
PyDict_New at /usr/local/src/conda/python-3.11.0/Objects/dictobject.c:841
type_ready_set_dict at /usr/local/src/conda/python-3.11.0/Objects/typeobject.c:6143 [inlined]
type_ready at /usr/local/src/conda/python-3.11.0/Objects/typeobject.c:6462 [inlined]
PyType_Ready at /usr/local/src/conda/python-3.11.0/Objects/typeobject.c:6513
_PyObject_GenericGetAttrWithDict at /usr/local/src/conda/python-3.11.0/Objects/object.c:1266
PyObject_GenericGetAttr at /usr/local/src/conda/python-3.11.0/Objects/object.c:1367 [inlined]
module_getattro at /usr/local/src/conda/python-3.11.0/Objects/moduleobject.c:761
PyObject_GetAttr at /usr/local/src/conda/python-3.11.0/Objects/object.c:916
PyObject_GetAttr at /home/ubuntu/.julia/packages/PythonCall/dsECZ/src/cpython/pointers.jl:299 [inlined]
pygetattr at /home/ubuntu/.julia/packages/PythonCall/dsECZ/src/abstract/object.jl:60
getproperty at /home/ubuntu/.julia/packages/PythonCall/dsECZ/src/Py.jl:272 [inlined]
#9 at /home/ubuntu/.julia/packages/PythonPlot/f591M/src/pygui.jl:194
macro expansion at ./asyncevent.jl:281 [inlined]
#666 at ./task.jl:134
unknown function (ip: 0x7ff7e519218f)
_jl_invoke at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/gf.c:2377 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/gf.c:2559
jl_apply at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/julia.h:1843 [inlined]
start_task at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/task.c:931
Allocations: 838271008 (Pool: 837751882; Big: 519126); GC: 109
Unfortunately I can't reproduce this segfault locally, but will check this works
Still segfaults but differently
signal (11): Segmentation fault
in expression starting at none:0
_PyInterpreterState_GET at /usr/local/src/conda/python-3.11.0/Include/internal/pycore_pystate.h:116 [inlined]
get_dict_state at /usr/local/src/conda/python-3.11.0/Objects/dictobject.c:251 [inlined]
new_dict at /usr/local/src/conda/python-3.11.0/Objects/dictobject.c:722 [inlined]
PyDict_New at /usr/local/src/conda/python-3.11.0/Objects/dictobject.c:841
type_ready_set_dict at /usr/local/src/conda/python-3.11.0/Objects/typeobject.c:6143 [inlined]
type_ready at /usr/local/src/conda/python-3.11.0/Objects/typeobject.c:6462 [inlined]
PyType_Ready at /usr/local/src/conda/python-3.11.0/Objects/typeobject.c:6513
_PyObject_GenericGetAttrWithDict at /usr/local/src/conda/python-3.11.0/Objects/object.c:1266
PyObject_GenericGetAttr at /usr/local/src/conda/python-3.11.0/Objects/object.c:1367 [inlined]
module_getattro at /usr/local/src/conda/python-3.11.0/Objects/moduleobject.c:761
PyObject_GetAttr at /usr/local/src/conda/python-3.11.0/Objects/object.c:916
PyObject_GetAttr at /home/ubuntu/.julia/packages/PythonCall/dsECZ/src/cpython/pointers.jl:299 [inlined]
macro expansion at /home/ubuntu/.julia/packages/PythonCall/dsECZ/src/Py.jl:131 [inlined]
pyhasattr at /home/ubuntu/.julia/packages/PythonCall/dsECZ/src/abstract/object.jl:37
#9 at /home/ubuntu/.julia/packages/PythonPlot/ei8cR/src/pygui.jl:194
macro expansion at ./asyncevent.jl:281 [inlined]
#666 at ./task.jl:134
unknown function (ip: 0x7fac1b57080f)
_jl_invoke at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/gf.c:2377 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/gf.c:2559
jl_apply at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/julia.h:1843 [inlined]
start_task at /cache/build/default-amdci4-2/julialang/julia-release-1-dot-8/src/task.c:931
Allocations: 860081766 (Pool: 859557939; Big: 523827); GC: 110
Why is the gui even being initialized during the test suite? We set the backend to Agg…
We run our test suite with xvfb because it also includes GLMakie plots. Could it be that?
I should add that this didn't happen with PyPlot.jl
https://github.com/stevengj/PythonPlot.jl/blob/9a7d10e72b8800864ebabe4e8cbbae6b93acfa4b/test/runtests.jl#L1 should take precedence unless you have already loaded/initialized PythonPlot.jl somewhere else