#9636: Catch output from PARI in Sage
------------------------------+---------------------------------------------
   Reporter:  jdemeyer        |       Owner:  was            
       Type:  defect          |      Status:  positive_review
   Priority:  major           |   Milestone:  sage-4.6       
  Component:  interfaces      |    Keywords:                 
     Author:  Jeroen Demeyer  |    Upstream:  N/A            
   Reviewer:  Leif Leonhardy  |      Merged:                 
Work_issues:                  |  
------------------------------+---------------------------------------------
Changes (by leif):

 * cc: robertwb (added)
  * reviewer:  => Leif Leonhardy
  * status:  needs_review => positive_review


Old description:

> The output from print() functions in libpari is directly written to
> stdout and is not caught by Sage.  For example, the following doctest
> fails:
> {{{
> def printhello():
>     """
>     sage: printhello()
>     hello
>     """
>     pari('print("hello")')
> }}}
> It gives
> {{{
> File "/home/jdemeyer/paritest.sage", line 3:
>     sage: printhello()
> Expected:
>     hello
> Got nothing
> }}}
>
> Luckily, libpari provides ways to redirect the output.  There should a
> small Cython wrapper to direct the PARI output to sys.stdout.write().
>
> Dependencies: #9661, #9343

New description:

 The output from {{{print()}}} functions in {{{libpari}}} is directly
 written to {{{stdout}}} and is not caught by Sage.  For example, the
 following doctest fails:
 {{{
 def printhello():
     """
     sage: printhello()
     hello
     """
     pari('print("hello")')
 }}}
 It gives
 {{{
 File "/home/jdemeyer/paritest.sage", line 3:
     sage: printhello()
 Expected:
     hello
 Got nothing
 }}}

 Luckily, {{{libpari}}} provides ways to redirect the output.  There should
 be a small Cython wrapper to direct the PARI output to Python's
 {{{sys.stdout.write()}}}.

 Dependencies: #9661, #9343

--

Comment:

 {{{
 cdef extern:
     PariOUT defaultOut
     PariOUT defaultErr

 }}}
 should perhaps migrate to {{{sage/libs/pari/decl.pxi}}}, too.

 '''Positive review''' from me though. Robert, anything to complain about?

 ----

 I wonder when Cython will support {{{const}}}...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9636#comment:6>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to