#14894: Fix PARI error handling for PARI 2.7
--------------------------------------+------------------------------
       Reporter:  vbraun              |        Owner:  jdemeyer
           Type:  defect              |       Status:  needs_info
       Priority:  major               |    Milestone:  sage-6.5
      Component:  packages: standard  |   Resolution:
       Keywords:  pari error signal   |    Merged in:
        Authors:  Peter Bruin         |    Reviewers:  Jeroen Demeyer
Report Upstream:  N/A                 |  Work issues:
         Branch:                      |       Commit:
   Dependencies:  #12142, #14873      |     Stopgaps:
--------------------------------------+------------------------------
Changes (by jdemeyer):

 * milestone:  sage-6.4 => sage-6.5


Old description:

> Pari GIT has made significant changes to the error handling code, which
> will require us to make some changes to Sage.
>
> This ticket reimplements PARI error handling inside Cython code using
> macros provided by `pari/paricom.h` instead of undocumented functions
> that no longer exist in PARI 2.6.  The new syntax is
> {{{
> sage_pari_catch()
> ... code ...
> sage_pari_catch_end()
> }}}
> Inside such a block one can put conditions like
> {{{
> if [some condition]:
>     sage_pari_catch_reset()
>     [return or raise exception]
> }}}
>
> The new functions catch PARI errors and also call `sig_on()` and
> `sig_off()` to enable interrupt handling.  This replaces the current hack
> of overriding `sig_on()` and `sig_off()`.
>
> Since `sage_pari_catch()` and `sage_pari_catch_end()` are C macros
> containing complementary braces, they ''must'' be on the same level in
> Cython code.  This means that several functions in
> `sage/libs/pari/gen.pyx`, most importantly `new_gen()`, no longer call
> `sig_off()` or its replacement `sage_pari_catch_end()`.  Instead of
> {{{
> sig_on()
> return new_gen(something returning GEN)
> }}}
> one therefore has to write
> {{{
> cdef gen result
> sage_pari_catch()
> result = new_gen(something returning GEN)
> sage_pari_catch_end()
> return result
> }}}
>
> This new approach fixes several (potential) problems with the existing
> one; see http://trac.sagemath.org/sage_trac/ticket/14873#comment:9.
>
> When upgrading to PARI 2.6, the only remaining change to be made
> (hopefully) is to replace the macros `CATCH`, `ENDCATCH`, `RETRY` and
> `CATCH_RELEASE` by `pari_CATCH`, `pari_ENDCATCH`, `pari_RETRY` and
> `pari_CATCH_reset`.
>
> Apply: [attachment:trac_14894-pari_catch-folded.patch]

New description:

 Instead of catching whatever PARI writes to `pariErr`, we should use a
 callback function `cb_pari_prehandle_exception`. That way, we don't need
 special tricks for warnings anymore.

--

--
Ticket URL: <http://trac.sagemath.org/ticket/14894#comment:54>
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/d/optout.

Reply via email to