Opened 7 years ago

Closed 2 years ago

#15522 closed defect (fixed)

Conversion gp -> string is broken

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-8.4
Component: interfaces Keywords:
Cc: Merged in:
Authors: Frédéric Chapoton Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 4400367 (Commits) Commit: 4400367d983fa74e82d23915efb31b01b14d3f4a
Dependencies: Stopgaps:

Description

sage: gp('"foo"').sage()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-5f1854206d09> in <module>()
----> 1 gp('"foo"').sage()

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in sage(self)
    867             Rational Field
    868         """
--> 869         return self._sage_()
    870 
    871     def __repr__(self):

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gp.pyc in _sage_(self)
    831             True
    832         """
--> 833         return pari(str(self)).python()
    834 
    835     def __long__(self):

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen.gen.python (sage/libs/pari/gen.c:10167)()

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/libs/pari/gen_py.pyc in python(z, locals)
    273     else:
    274         from sage.misc.sage_eval import sage_eval
--> 275         return sage_eval(str(z), locals=locals)

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/misc/sage_eval.pyc in sage_eval(source, locals, cmds, preparse)
    197         return locals['_sage_eval_returnval_']
    198     else:
--> 199         return eval(source, sage.all.__dict__, locals)
    200 
    201 

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/all.pyc in <module>()

NameError: name 'foo' is not defined

Attachments (1)

15522.patch (881 bytes) - added by jdemeyer 7 years ago.

Download all attachments as: .zip

Change History (15)

Changed 7 years ago by jdemeyer

comment:1 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:2 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:3 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:4 Changed 3 years ago by chapoton

  • Branch set to public/15522
  • Commit set to dd32c9c3a1883fc6999f0e86534fdc14a06682fa
  • Milestone changed from sage-6.4 to sage-8.3
  • Reviewers set to Frédéric Chapoton
  • Status changed from new to needs_review

New commits:

dd32c9ctrac 15522 conversion from pari strings

comment:5 Changed 3 years ago by chapoton

  • Status changed from needs_review to positive_review

Jeroen, I allow myself to set this to positive.

comment:6 Changed 3 years ago by jdemeyer

  • Authors changed from Jeroen Demeyer to Frédéric Chapoton
  • Status changed from positive_review to needs_work

comment:7 Changed 3 years ago by jdemeyer

  • Authors Frédéric Chapoton deleted
  • Branch public/15522 deleted
  • Commit dd32c9c3a1883fc6999f0e86534fdc14a06682fa deleted
  • Reviewers Frédéric Chapoton deleted

comment:8 Changed 3 years ago by chapoton

so, is this one a duplicate, or what ?

comment:9 Changed 3 years ago by jdemeyer

No, because gp is not pari (the first uses pexpect, the second uses cypari2)

comment:10 Changed 3 years ago by chapoton

Indeed. Using the branch from #25289, one gets

sage: gp('"toto"')
toto
sage: pari('"toto"')
"toto"

comment:11 Changed 2 years ago by vdelecroix

  • Milestone changed from sage-8.3 to sage-8.4

update milestone 8.3 -> 8.4

comment:12 Changed 2 years ago by chapoton

  • Authors set to Frédéric Chapoton
  • Branch set to public/15522
  • Commit set to 4400367d983fa74e82d23915efb31b01b14d3f4a
  • Status changed from needs_work to needs_review

New commits:

4400367fix conversion from gp strings to sage strings

comment:13 Changed 2 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:14 Changed 2 years ago by vbraun

  • Branch changed from public/15522 to 4400367d983fa74e82d23915efb31b01b14d3f4a
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.