#9640: Change PARI error catching mechanism
----------------------------------------+-------------------------
       Reporter:  jdemeyer              |        Owner:  was
           Type:  enhancement           |       Status:  new
       Priority:  major                 |    Milestone:  sage-5.12
      Component:  interfaces            |   Resolution:
       Keywords:  pari error interrupt  |    Merged in:
        Authors:  Jeroen Demeyer        |    Reviewers:
Report Upstream:  N/A                   |  Work issues:
         Branch:                        |       Commit:
   Dependencies:                        |     Stopgaps:
----------------------------------------+-------------------------

Comment (by pbruin):

 I am working on a patch that does the following things suggested by the
 ticket description:
 - Rewrite `pari_catch_sig_on()` and `pari_catch_sig_off()` to use the
 callbacks `cb_pari_handle_exception` and `cb_pari_err_recover` (defined by
 the PARI library) in combination with `sig_on()`/`sig_off()`, as opposed
 to the additional `setjmp()` of the current implementation.
 - Catch output sent to `pariErr` and store it in a string attribute
 `pari_instance.error_string` for later use by `PariError`.

 It seems to work quite well; the only doctest failures I've seen so far
 are a few tests expecting a PARI warning message.  With the patch, these
 are not printed because they also go to `pariErr`.

 To be done:
 - Make `PariError` aware of the stored string to give a more informative
 error message.  This should probably simply be extracted from the lines
 starting with `***` in `pari_instance.error_string`.
 - Minor change in PARI: send any extra newline at the start of the error
 message to `pariErr` instead of `pariOut` (this happens if the last
 printed character was not a newline).
 - Distinguish between errors and warnings; the latter should probably be
 printed to `stderr` as before.  This should be done either by filtering
 the text sent to `pariErr` or by having `pari_catch_sig_off()` check if
 `pari_instance.error_string` is non-empty even if no error occurred.

 This may make #14894 redundant, although that ticket could be used for
 general things to be done for the upgrade to PARI 2.6.

--
Ticket URL: <http://trac.sagemath.org/ticket/9640#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to