#9640: Change PARI error catching mechanism
----------------------------------------+----------------------------
Reporter: jdemeyer | Owner: was
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.12
Component: interfaces | Resolution:
Keywords: pari error interrupt | Merged in:
Authors: Peter Bruin | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
----------------------------------------+----------------------------
Changes (by pbruin):
* status: needs_work => needs_review
* work_issues: see comment 6 =>
Old description:
> Currently, the exceptions thrown by PARI are rather cryptic, like
> {{{
> Traceback (most recent call last):
> ...
> PariError: (15)
> }}}
>
> Using a mechanism similar to #9636, it should be possible to catch the
> full text of the exception and use it to throw {{{PariError}}}. We
> should change to using {{{cb_pari_handle_exception()}}} instead of
> {{{err_catch()}}} to catch PARI exceptions.
>
> Dependencies: #10115, #9893, #9678
New description:
Currently, the exceptions thrown by PARI are rather cryptic, like
{{{
Traceback (most recent call last):
...
PariError: (15)
}}}
This ticket does the following:
- Use {{{cb_pari_handle_exception()}}} instead of {{{err_catch()}}} to
catch PARI exceptions.
- Using a mechanism similar to #9636, catch the full text of the exception
and pass it to {{{PariError}}}. (It is not printed automatically, but can
be accessed via `PariError.errtext()`.)
Apply: [attachment:9640-pari_error_callbacks.patch]
--
Comment:
The latest patch does everything that I think it should do. I hope it is
reasonably self-explanatory. A few remarks:
- The error text is now passed to `PariError` and can be accessed using
`PariError.errtext()`; is is not printed automatically. Using this text
to improve messages like `PariError: (15)` will probably have to wait
until another ticket.
- There is no problem with PARI sending escape sequences for colours in
error messages; this is disabled by default.
- The printing of a possible extra newline before the error message is
easily avoided using `pari_set_last_newline(1)`.
- The callback functions are now Cython functions in the new file
`pari_error.pyx`. It is important that this does ''not'' include
`pari_err.pxi`; because of the way Cython imports functions,
`pari_err.pxi` and `pari_err.h` use function pointers with the same names
as the functions defined in `pari_error.pyx`.
--
Ticket URL: <http://trac.sagemath.org/ticket/9640#comment:10>
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.