Opened 7 years ago

Closed 7 years ago

#19575 closed defect (fixed)

Conversion PARI t_STR -> Python str should not keep quotes

Reported by: Jeroen Demeyer Owned by:
Priority: major Milestone: sage-6.10
Component: interfaces: optional Keywords:
Cc: Peter Bruin Merged in:
Authors: Jeroen Demeyer Reviewers: Peter Bruin
Report Upstream: N/A Work issues:
Branch: 1668133 (Commits, GitHub, GitLab) Commit: 1668133626492e0b9e94b03fe98d67279e1cca3c
Dependencies: Stopgaps:

Status badges

Description

This should be without quotes, similar to the difference between repr() and str() of a Python string:

sage: print pari('"hello world"')
"hello world"

Change History (7)

comment:1 Changed 7 years ago by Jeroen Demeyer

Branch: u/jdemeyer/str_pari_gen

comment:2 Changed 7 years ago by Jeroen Demeyer

Commit: 29128c2ada7a6465d470336dbcc0e8061ea497f4
Status: newneeds_review

New commits:

29128c2Implement conversion PARI t_STR -> Python string

comment:3 Changed 7 years ago by Peter Bruin

Reviewers: Peter Bruin
Status: needs_reviewneeds_work
  • The patchbot reports a doctest failure in sage.interfaces.interface.InterfaceElement.__reduce__. I think the quoted version "abc" is the correct output. Probably gen.__reduce__() should use __repr__() instead of __str__().
  • It would look better to use %r in the error message that you change in the patch, and actually I would also prefer putting a space after the =, i.e.
    raise TypeError("x (= %r) must be of type t_INT, but is of type %s" % (x, x.type()))
    

(For the second point, maybe we can even remove the type check and rely on PARI to raise an error.)

comment:4 Changed 7 years ago by git

Commit: 29128c2ada7a6465d470336dbcc0e8061ea497f41668133626492e0b9e94b03fe98d67279e1cca3c

Branch pushed to git repo; I updated commit sha1. New commits:

674fb90Use repr() for pickling
1668133Do not check type in binary(), let PARI raise an error

comment:5 Changed 7 years ago by Jeroen Demeyer

Status: needs_workneeds_review

comment:6 Changed 7 years ago by Peter Bruin

Status: needs_reviewpositive_review

Looks good.

comment:7 Changed 7 years ago by Volker Braun

Branch: u/jdemeyer/str_pari_gen1668133626492e0b9e94b03fe98d67279e1cca3c
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.