Opened 12 years ago

Closed 7 years ago

#3423 closed enhancement (duplicate)

Make Pari error messages more informative

Reported by: ncalexan Owned by: was
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: interfaces Keywords:
Cc: craigcitro Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Consider this sage session:

sage: pari('1.q')
---------------------------------------------------------------------------
<class 'sage.libs.pari.gen.PariError'>    Traceback (most recent call last)

/Users/ncalexan/sage-3.0.1.alpha0/devel/sage-cc/sage/rings/number_field/<ipython console> in <module>()

/Users/ncalexan/sage-3.0.1.alpha0/devel/sage-cc/sage/rings/number_field/gen.pyx in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:32332)()

<class 'sage.libs.pari.gen.PariError'>:  (7)

as opposed to this gp session:

? 1.q
  ***   unknown member function: 1.q
                                   ^-

It'd be nice if the error messages we generate are a bit more informative. This may be an arbitrarily large amount of work.

Change History (3)

comment:1 Changed 11 years ago by malb

I think I tracked down why we can't display more information as of now:

The pari_err function contains the following code:

pari_err(long numerr, ...)
{
  char s[128], *ch1;
  PariOUT *out = pariOut;
  va_list ap;

  va_start(ap,numerr);
  if (is_warn(numerr)) pari_err(talker,"use pari_warn for warnings");

  global_err_data = NULL;
  if (err_catch_stack)
  {
    cell *trapped = NULL;
    if ( (trapped = err_seek(numerr)) )
    {
      jmp_buf *e = trapped->penv;
      if (numerr == invmoder)
      {
        (void)va_arg(ap, char*); /* junk 1st arg */
        global_err_data = (void*)va_arg(ap, GEN);
      }
      longjmp(*e, numerr);
    }

The difference between us and gp is that if (err_catch_stack) evaluates to true because all our pari calls are encapsulated in _sig_on/_sig_off calls.

comment:2 Changed 11 years ago by craigcitro

  • Cc craigcitro added

comment:3 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-wishlist to sage-duplicate/invalid/wontfix
  • Report Upstream set to N/A
  • Resolution set to duplicate
  • Reviewers set to Jeroen Demeyer
  • Status changed from new to closed

Duplicate of #9640.

Note: See TracTickets for help on using tickets.