#11868: PARI library interface broken by design
---------------------------------------+------------------------------
       Reporter:  jdemeyer             |        Owner:  was
           Type:  defect               |       Status:  needs_review
       Priority:  major                |    Milestone:  sage-5.13
      Component:  interfaces           |   Resolution:
       Keywords:  t0GEN t1GEN gen      |    Merged in:
        Authors:  Peter Bruin          |    Reviewers:  Jeroen Demeyer
Report Upstream:  N/A                  |  Work issues:
         Branch:                       |       Commit:
   Dependencies:  #864, #9640, #10018  |     Stopgaps:
---------------------------------------+------------------------------
Description changed by jdemeyer:

Old description:

> The `t0GEN()`, `t1GEN()`,... system in the PARI interface is broken by
> design.  Apply [attachment:demonstrate_11868.patch] to see the bug in
> action.
>
> The problem is that the conversion of `b` (Python object) to `t1` (PARI
> GEN) uses the PARI stack and therefore it clobbers the previously
> computed `t0`.
>
> There is no urgent need to fix this, as the bug doesn't seem to occur in
> practice (it was discovered when working on #9334).  It only occurs when:
>  1. Calling a PARI function with at least 2 arguments besides `self`.
>  2. Apart from the first non-`self` argument, there should be another
> argument which is a "complicated" Python type (e.g. a number field
> element).
>
> As work-around, it is easy to defeat condition 2 by converting arguments
> to pari before calling the function.
>
> This problem can be solved by using only local variables instead of
> `t0GEN` etc.
>
> Apply: [attachment:trac_11868-t0GEN_new.patch],
> [attachment:trac_11868-remove_workarounds.patch]

New description:

 The `t0GEN()`, `t1GEN()`,... system in the PARI interface is broken by
 design.  Apply [attachment:demonstrate_11868.patch] to see the bug in
 action.

 The problem is that the conversion of `b` (Python object) to `t1` (PARI
 GEN) uses the PARI stack and therefore it clobbers the previously computed
 `t0`.

 There is no urgent need to fix this, as the bug doesn't seem to occur in
 practice (it was discovered when working on #9334).  It only occurs when:
  1. Calling a PARI function with at least 2 arguments besides `self`.
  2. Apart from the first non-`self` argument, there should be another
 argument which is a "complicated" Python type (e.g. a number field
 element).

 As work-around, it is easy to defeat condition 2 by converting arguments
 to pari before calling the function.

 This problem can be solved by using only local variables instead of
 `t0GEN` etc.

 Apply: [attachment:trac_11868-t0GEN_new.patch],
 [attachment:trac_11868-remove_workarounds.patch],
 [attachment:11868_pari_extra.patch]

--

--
Ticket URL: <http://trac.sagemath.org/ticket/11868#comment:25>
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.

Reply via email to