Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Pari error messages more informative #3423

Closed
ncalexan mannequin opened this issue Jun 14, 2008 · 3 comments
Closed

Make Pari error messages more informative #3423

ncalexan mannequin opened this issue Jun 14, 2008 · 3 comments

Comments

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Jun 14, 2008

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.

CC: @craigcitro

Component: interfaces

Reviewer: Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/3423

@ncalexan ncalexan mannequin added c: interfaces labels Jun 14, 2008
@ncalexan ncalexan mannequin assigned williamstein Jun 14, 2008
@malb
Copy link
Member

malb commented Jan 22, 2009

comment:1

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.

@jdemeyer
Copy link

jdemeyer commented Nov 2, 2013

comment:3

Duplicate of #9640.

@jdemeyer
Copy link

jdemeyer commented Nov 2, 2013

Reviewer: Jeroen Demeyer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants