#11868: PARI library interface broken by design
-----------------------------------+------------------------------
       Reporter:  jdemeyer         |        Owner:  was
           Type:  defect           |       Status:  needs_work
       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:                   |     Stopgaps:
-----------------------------------+------------------------------

Comment (by pbruin):

 Replying to [comment:17 jdemeyer]:
 > I don't my suggestion would create more `gen` objects.
 It doesn't create any more `gen` objects than what we have now, but I
 wanted (and failed for now) to create ''fewer'' `gen` objects than what we
 have now.
 > What usually happens is (with this patch applied):
 > - some PARI computation creates a `GEN` on the PARI stack
 > - `_new_gen()` calls `deepcopy_to_python_heap` which copies the object
 to the Python heap and makes it into a `gen` object
 > - `toGEN` copies the object back to the PARI stack
 >
 > My proposal is essentially removing the last step.
 That is what happens for objects with a `_pari_()` method.  For other
 objects, my idea was to not create any `gen` object and keep the converted
 `GEN` on the PARI stack.  Ideally, `toGEN()` should either leave the
 temporary `GEN` in the Python heap (if it comes from an existing `gen` or
 from a `_pari_()` method) or on the PARI stack (if it is converted,
 withouth an intermediate `gen`, from a Python object without a `_pari_()`
 method).

 Anyway, this idea is now defeated for the time being because of comment:18
 and comment:20.  To implement it, we would need a more fine-grained way of
 clearing the PARI stack (only clear what you have used, and leave the rest
 of the stack alone).

 Now working on a new patch in the spirit of comment:11.

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