#9640: Change PARI error catching mechanism
-----------------------------------------------+---------------------------
Reporter: jdemeyer | Owner: was
Type: enhancement | Status:
Priority: major | needs_review
Component: interfaces | Milestone: sage-5.13
Keywords: pari error interrupt | Resolution:
Authors: Peter Bruin, Jeroen Demeyer | Merged in:
Report Upstream: N/A | Reviewers:
Branch: | Work issues:
Dependencies: #14029, #13311 | Commit:
| Stopgaps:
-----------------------------------------------+---------------------------
Comment (by pbruin):
Replying to [comment:29 jdemeyer]:
> Replying to [comment:28 pbruin]:
> > What is the use of `PariError.parimessage()`? It doesn't seem to be
used, and appears to normally be a substring of `PariError.__str__()`. Do
you have any application for it in mind, or can it be removed?
> For me, it can be removed. But it existed before (as a function
`__errmessage()`) and one possible use would be to check that an error is
of a given type without relying on the PARI error codes (for example, in
pure Python code).
That is a possibility. On the other hand, the global variable
`errmessage` is another thing that has disappeared in PARI 2.6. It has
been replaced by a function `const char *numerr_name(long numerr)` which
returns e.g. `"e_INV"` for zero division errors. This means that in the
near future your example will probably look like
{{{
#!python
if pari.numerr_name(E.errnum()) == "e_INV":
raise ZeroDivisionError
}}}
Of course, one could then think of a method of `PariError` encapsulating
this if necessary, but `parimessage` would no longer be an appropriate
name.
For the time being (at least until we switch to PARI 2.6) or unless
someone really wants a method like this, I think it is easiest to just
remove it.
--
Ticket URL: <http://trac.sagemath.org/ticket/9640#comment:30>
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.