Hi,
Le 06/03/2015 23:33, Bill Allombert a écrit :
On Thu, Mar 05, 2015 at 05:46:13PM +0100, Julien Puydt wrote:
cdef GEN E
cdef long errnum
cdef jmp_buf env
iferr_env = &env
if setjmp (iferr_env[0]) != 0:
E = pari_err_last()
errnum = E[1]
_pari_err_handle(E)
cb_pari_err_recover(errnum)
Did I miss something about pari (in which case you can probably
help), or something about sage (in which case sage-devel's
mailing-list might help) ?
Where are you including this code ? This is the crucial point.
I do not think it is possible to use setjmp in a subfunction like
_pari_init_error_handling().
Yes, it is possible. But declaring the jmp_buf inside a function was
bad, as it made it local! I moved some declarations around, and I get my
piece of code called on error : now when there is an error, I can push
the error up sage's stack. See below for where it still fails.
How does cb_pari_err_recover() work ?
Their cb_pari_err_handle detects if it's a short stack problem (errnum
== e_STACK), in which case it doubles the stack and doesn't throw an
exception. If it's another problem, it blocks exceptions, throws one and
unblock.
Then cb_pari_err_recover gets called: if no exception has been thrown,
it decides the stack was doubled and retries. If an exception has been
thrown, it throws it further.
The question of how an unblocked exception still isn't really thrown and
another function gets called which gets a second chance to throw it...
is an interesting question!
How does the old code worked ?
I don't really know :-/
What is sure is that my patch *almost* works : for usual errors, it
does. It just doesn't handle the issue of short stack well : there's a
segfault, and none of my code gets called, so I can't retry... If there
were no segfault, I guess I would have an e_STACK errnum and everything
would be ok.
Snark on #debian-science
--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org