#14894: Fix PARI error handling (needed for future upgrade to PARI 2.6)
--------------------------------------+-------------------------------
Reporter: vbraun | Owner: jdemeyer
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.12
Component: packages: standard | Resolution:
Keywords: pari error signal | Merged in:
Authors: Peter Bruin | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Dependencies: #12142, #14873
Stopgaps: |
--------------------------------------+-------------------------------
Comment (by pbruin):
Replying to [comment:12 jdemeyer]:
> Since this is low-level C code, I cannot believe a decorator (which is
on the level of Python) would work.
Maybe I can convince you by giving the definition of the decorator:
{{{
def pari_catch_function(f):
"""
Decorator to wrap a function in sage_pari_catch() ...
sage_pari_catch_end().
EXAMPLE::
"""
def g(*args):
cdef object _x
sage_pari_catch()
_x = f(*args)
sage_pari_catch_end()
return _x
return g
}}}
I put this in a Cython file and tested it. It works, but probably it is
not very good for efficiency.
Something that I do ''not'' see how to do easily, on the other hand, is a
context guard (context manager) for use with the `with` statement, i.e.
{{{
with pari_catch:
...code...
}}}
giving you catching of PARI errors and signals within the block.
--
Ticket URL: <http://trac.sagemath.org/ticket/14894#comment:15>
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.