I've rewritten the code for moving to the new IPython to make it more
flexible, and I'm running into a puzzling problem. When I call
quit_sage from an exit handler, for some reason the pari_close() call
happening inside the pari._unsafe_deallocate_pari_stack function causes
a segfault. This only happens (in my testing) when all of the following
are true:
* the exit handler is called in a particular way (triggered from the
IPython shutdown hook)
* sage is doctesting a file that creates an IPython test shell. When
running the doctests with gdb, after all of the doctests are done, the
program segfaults and gdb reports this error:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000011
0x000000010156dac8 in pari_close ()
(gdb) where
#0 0x000000010156dac8 in pari_close ()
#1 0x0000000102bf0bd7 in
__pyx_pw_4sage_4libs_4pari_3gen_12PariInstance_3_unsafe_deallocate_pari_sta ck
(__pyx_v_self=<value temporarily unavailable, due to optimizations>,
unused=<value temporarily unavailable, due to optimizations>) at
sage/libs/pari/gen.c:46888
Previous frame inner to this frame (gdb could not unwind past this frame)
I realize this is really vague, so I might need to put up more details
or the code. But I'm curious at this point if someone has even a clue
about what might be happening. What would cause an error like I'm seeing?
Thanks,
Jason
P.S. This is what I'm seeing when I doctest:
% sage -t interpreter.py
sage -t "devel/sage-main/sage/misc/interpreter.py"
The doctested process was killed by signal 11
[5.8 s]
----------------------------------------------------------------------
The following tests failed:
sage -t "devel/sage-main/sage/misc/interpreter.py" # Killed/crashed
Total time for all tests: 5.8 seconds