Opened 10 years ago

Closed 10 years ago

#9636 closed defect (fixed)

Catch output from PARI in Sage

Reported by: jdemeyer Owned by: was
Priority: major Milestone: sage-4.6
Component: interfaces Keywords:
Cc: leif, robertwb Merged in: sage-4.6.alpha0
Authors: Jeroen Demeyer Reviewers: Leif Leonhardy
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by leif)

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

Attachments (1)

9636.patch (2.4 KB) - added by jdemeyer 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by jdemeyer

  • Milestone set to sage-4.6

comment:2 Changed 10 years ago by jdemeyer

  • Authors set to Jeroen Demeyer

comment:3 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:4 Changed 10 years ago by jdemeyer

  • Status changed from new to needs_review

comment:5 Changed 10 years ago by leif

  • Cc leif added

Changed 10 years ago by jdemeyer

comment:6 Changed 10 years ago by leif

  • Cc robertwb added
  • Description modified (diff)
  • Reviewers set to Leif Leonhardy
  • Status changed from needs_review to positive_review
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...

comment:7 Changed 10 years ago by mpatel

  • Merged in set to sage-4.6.alpha0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.