Opened 7 years ago
Closed 7 years ago
#14780 closed enhancement (fixed)
allow embedding python tuples in SR
Reported by:  burcin  Owned by:  burcin 

Priority:  major  Milestone:  sage6.2 
Component:  symbolics  Keywords:  sd48 
Cc:  eviatarbach  Merged in:  
Authors:  Burcin Erocal, Volker Braun  Reviewers:  Volker Braun, JeanPierre Flori 
Report Upstream:  N/A  Work issues:  
Branch:  aa7287f (Commits)  Commit:  aa7287f676a96f486af609ea36554820e0b3d7bc 
Dependencies:  Stopgaps: 
Description (last modified by )
Attached patch allows embedding Python tuples in symbolic expressions:
sage: t = SR._force_tuple((1, 2, x, x+1, x+2)) sage: t (1, 2, x, x + 1, x + 2) sage: t.subs(x = 2*x^2) (1, 2, 2*x^2, 2*x^2 + 1, 2*x^2 + 2) sage: t.op[0] 1 sage: t.op[2] x
Includes pynac 0.3.2 update for explicit template instantiatitons
http://boxen.math.washington.edu/home/vbraun/upstream/pynac0.3.2.tar.bz2
Attachments (1)
Change History (50)
comment:1 Changed 7 years ago by
 Description modified (diff)
 Keywords sd48 added
 Status changed from new to needs_review
comment:2 followup: ↓ 3 Changed 7 years ago by
comment:3 in reply to: ↑ 2 Changed 7 years ago by
Replying to vbraun:
We were discussing an optional
recursive=[TrueFalse]
keyword argument at SD48. Are you still going to implement this?
I replaced the attached patch. New version supports recursive=[TrueFalse]
.
Changed 7 years ago by
comment:4 Changed 7 years ago by
 Reviewers set to Volker Braun
 Status changed from needs_review to positive_review
Looks good to me
comment:5 Changed 7 years ago by
 Milestone changed from sage5.11 to sage5.12
comment:6 Changed 7 years ago by
 Status changed from positive_review to needs_work
On buildbot machine redhawk (Ubuntu 10.04 x86_64):
sage t long devel/sage/sage/symbolic/ring.pyx ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 312, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t = SR._force_pyobject((1, 2, x, x+1, x+2)); t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[2]>", line 1, in <module> t = SR._force_pyobject((Integer(1), Integer(2), x, x+Integer(1), x+Integer(2))); t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 314, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x = 2*x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[3]>", line 1, in <module> t.subs(x = Integer(2)*x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 323, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t = SR._force_pyobject([1, 2, x, x+1, x+2]); t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[6]>", line 1, in <module> t = SR._force_pyobject([Integer(1), Integer(2), x, x+Integer(1), x+Integer(2)]); t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 325, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x = 2*x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[7]>", line 1, in <module> t.subs(x = Integer(2)*x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 327, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: SR._force_pyobject((QQ, RR, CC)) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[8]>", line 1, in <module> SR._force_pyobject((QQ, RR, CC)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 329, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t = SR._force_pyobject((QQ, (x, x + 1, x + 2), CC)); t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[9]>", line 1, in <module> t = SR._force_pyobject((QQ, (x, x + Integer(1), x + Integer(2)), CC)); t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 331, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x=x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[10]>", line 1, in <module> t.subs(x=x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 338, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[12]>", line 1, in <module> t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 341, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x=x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[13]>", line 1, in <module> t.subs(x=x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.12.beta0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 259, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4624) File "ring.pyx", line 661, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7574) TypeError: std::bad_cast **********************************************************************
comment:7 Changed 7 years ago by
 Status changed from needs_work to positive_review
Hmm... this works for me with sage5.13.beta2
on Ubuntu 12.04 LTS, 32bit with a AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ x2. Also it works for the patchbot(s) running x86_64 architectures. This might also work now since I think we've upgraded cython between now and the last time this was tested... So I'm going to set this back to positive review.
comment:8 Changed 7 years ago by
 Status changed from positive_review to needs_work
On the buildbot machine redhawk
(Ubuntu 10.04 x86_64):
sage t long devel/sage/sage/symbolic/ring.pyx ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 317, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t = SR._force_pyobject((1, 2, x, x+1, x+2)); t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[2]>", line 1, in <module> t = SR._force_pyobject((Integer(1), Integer(2), x, x+Integer(1), x+Integer(2))); t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 319, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x = 2*x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[3]>", line 1, in <module> t.subs(x = Integer(2)*x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 328, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t = SR._force_pyobject([1, 2, x, x+1, x+2]); t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[6]>", line 1, in <module> t = SR._force_pyobject([Integer(1), Integer(2), x, x+Integer(1), x+Integer(2)]); t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 330, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x = 2*x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[7]>", line 1, in <module> t.subs(x = Integer(2)*x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 332, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: SR._force_pyobject((QQ, RR, CC)) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[8]>", line 1, in <module> SR._force_pyobject((QQ, RR, CC)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 334, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t = SR._force_pyobject((QQ, (x, x + 1, x + 2), CC)); t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[9]>", line 1, in <module> t = SR._force_pyobject((QQ, (x, x + Integer(1), x + Integer(2)), CC)); t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 336, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x=x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[10]>", line 1, in <module> t.subs(x=x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 343, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[12]>", line 1, in <module> t File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast ********************************************************************** File "devel/sage/sage/symbolic/ring.pyx", line 346, in sage.symbolic.ring.SymbolicRing._force_pyobject Failed example: t.subs(x=x^2) Exception raised: Traceback (most recent call last): File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 479, in _run self.execute(example, compiled, test.globs) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 838, in execute exec compiled in globs File "<doctest sage.symbolic.ring.SymbolicRing._force_pyobject[13]>", line 1, in <module> t.subs(x=x**Integer(2)) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "/scratch/buildbot/sage/redhawk1/redhawk_full/build/sage5.13.rc0/local/lib/python2.7/sitepackages/sage/misc/displayhook.py", line 451, in __call__ self.oldhook(obj) File "sage_object.pyx", line 154, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1921) File "expression.pyx", line 521, in sage.symbolic.expression.Expression._repr_ (sage/symbolic/expression.cpp:4629) File "ring.pyx", line 666, in sage.symbolic.ring.SymbolicRing._repr_element_ (sage/symbolic/ring.cpp:7670) TypeError: std::bad_cast **********************************************************************
comment:9 Changed 7 years ago by
 Branch set to t/14780/python_tuples_in_SR
comment:10 Changed 7 years ago by
 Branch changed from t/14780/python_tuples_in_SR to u/vbraun/python_tuples_in_SR
 Commit set to d6aa8ff7d1381db12a46e38cb9528127623ab346
New commits:
d6aa8ff  Allow embedding tuples in SR.

comment:11 Changed 7 years ago by
Backtrace (with gdb "catch throw"):
(gdb) bt #0 0x00007ffff3c17dc0 in __cxa_throw () from /usr/lib/libstdc++.so.6 #1 0x00007ffff3c16ba2 in __cxa_bad_cast () from /usr/lib/libstdc++.so.6 #2 0x00007fffcdecb9fc in GiNaC::print_memfun_handler<GiNaC::container<std::vector>, GiNaC::print_context>::operator()(GiNaC::basic const&, GiNaC::print_context const&, unsigned int) const () from /home/vbraun/Sage/git/local/lib/libpynac.so.0 #3 0x00007fffcde90928 in GiNaC::print_functor::operator()(GiNaC::basic const&, GiNaC::print_context const&, unsigned int) const () from /home/vbraun/Sage/git/local/lib/libpynac.so.0 #4 0x00007fffcde8cb92 in GiNaC::basic::print_dispatch(GiNaC::class_info<GiNaC::registered_class_options> const&, GiNaC::print_context const&, unsigned int) const () from /home/vbraun/Sage/git/local/lib/libpynac.so.0 #5 0x00007fffcde8c756 in GiNaC::basic::print(GiNaC::print_context const&, unsigned int) const () from /home/vbraun/Sage/git/local/lib/libpynac.so.0 #6 0x00007fffcdebc2e9 in GiNaC::ex::print(GiNaC::print_context const&, unsigned int) const () from /home/vbraun/Sage/git/local/lib/libpynac.so.0 #7 0x00007fffcdf9ea66 in GiNaC::operator<<(std::ostream&, GiNaC::ex const&) () from /home/vbraun/Sage/git/local/lib/libpynac.so.0 #8 0x00007fffcd654e9a in _to_PyString<GiNaC::ex> (x=<optimized out>) at /home/vbraun/Sage/git/local/include/csage/ccobject.h:105
comment:12 Changed 7 years ago by
I suspect that this is a case of http://gcc.gnu.org/faq.html#dso
You can't (without wonky workarounds) use RTTI across shared libraries. We instantiate GiNaC templates in Sage, and std::dynamic_cast
does not consider those the same as instantiations in the pynac shared library. Toughts?
comment:13 Changed 7 years ago by
Possibly, but why does it only seem to fail on that specific machine? I would think if that really were the case, then it should fail across different machines, or at least different versions of Ubuntu...
comment:14 Changed 7 years ago by
Some compiler/linker combination may leave unused instantiations around, or instantiate too much. Its possible to only be triggered on some machines...
comment:15 Changed 7 years ago by
 Milestone changed from sage6.1 to sage6.2
comment:16 Changed 7 years ago by
All tests pass on 6.2.base2 on an AMD Phenom II X6 1055T with OpenSuSE. Does the problem on the one machine still persist?
comment:17 Changed 7 years ago by
Afaik nothing changed, so it'll still fail on Sparc. If you want to help we can get you an account. Or start a post on sagedevel to remove Sparc from the list of firstclass supported platforms. IMHO it would be way more useful to spend time on ARM and POWER7 than on a longdead platform that is plagued by linker bugs.
comment:18 Changed 7 years ago by
So let's wait for answers to https://groups.google.com/forum/#!topic/sagedevel/8fkkRn4JJrw
comment:19 Changed 7 years ago by
FYI I have no bad_cast issue on a sparc/Solaris machine (UST2+) using FSF GCC 4.7.3 and the Sun linker.
$ uname a SunOS blabliblu 5.10 Generic_13955508 sun4v sparc SUNW,T5140 $ gcc v Utilisation des specs internes. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/infres/post/flori/local32+i1/libexec/gcc/sparcsunsolaris2.10/4.7.3/ltowrapper Target: sparcsunsolaris2.10 Configuré avec: ../gcc4.7.3/configure prefix=/infres/post/flori/local32+i1/ withlocalprefix=/infres/post/flori/local32+i1/ withgmp=/infres/post/flori/local32+i1/ withmpfr=/infres/post/flori/local32+i1/ withmpc=/infres/post/flori/local32+i1/ withas=/usr/ccs/bin/as withld=/usr/ccs/bin/ld programsuffix=4.7.3 enablelanguages=c,c++,fortran,lto Modèle de thread: posix gcc version 4.7.3 (GCC) $ ld V ld: Software Generation Utilities  Solaris Link Editors: 5.101.493 $
But as I'm looking at this ticket, I see redhawk
is mentioned as the problematic machine and this isn't a sparc machine...
jpflori@redhawk:~$ uname a Linux redhawk 2.6.3244server #98Ubuntu SMP Mon Sep 24 17:41:33 UTC 2012 x86_64 GNU/Linux
So was the problem occuring on another machine? (mark?)
comment:20 Changed 7 years ago by
So, rereading this, it was *not on a Sparc machine but a specific Ubuntu one. Can someone test this on a new Ubuntu installation? If it works then even if another specific Ubuntu version fails there should not be anything holding up this ticket any longer.
comment:21 Changed 7 years ago by
From comment:8, the Ubuntu version is the LTS one from 4 years ago. There's been one two years ago and will be a new one next month, so I would be in favor of ignoring the redhawk problem (and maybe update the system there to 12.04, or even 14.04 when its out).
comment:22 Changed 7 years ago by
Just for what it's worth, could you try adding
import ctypes flags = sys.getdlopenflags() sys.setdlopenflags(flags  ctypes.RTLD_GLOBAL)
to src/sage/all.py
and retest on redhawk
?
comment:23 followup: ↓ 24 Changed 7 years ago by
Setting RTLD_GLOBAL
fixes the std::bad_cast
on redhawk, interestingly. But it also leads to segfaults elsewhere...
comment:24 in reply to: ↑ 23 Changed 7 years ago by
Replying to vbraun:
Setting
RTLD_GLOBAL
fixes thestd::bad_cast
on redhawk, interestingly. But it also leads to segfaults elsewhere...
Yeah, I guess it could have been expected and that it is not a completely random choice that Python does not set it by default as it might expect to load a bunch of libraries and get symbols conflicts. Though the fact that it is set by default on Darwin does not really point in that direction...
What about linking sage/symbolic/ring.pyx/so with libpynac.so? that is modify module_list.py to achieve that.
comment:25 Changed 7 years ago by
Building with SAGE_INSTALL_GCC
seems to work... do we have a simple way to shitlist certain compilers by now?
comment:26 Changed 7 years ago by
I think so, look into the magic which decides when to automatically install GCC in `build/install`.
Some combinations are already "forbidden".
comment:27 Changed 7 years ago by
Rebuild from scratch on redhawk and now all tests pass even without SAGE_INSTALL_GCC
(??)
comment:28 Changed 7 years ago by
Recompiled, doctests fail grrr...
comment:29 Changed 7 years ago by
Did you try the linking trick? It seems I have access to redhawk, I'll give it a shot anyway.
comment:30 Changed 7 years ago by
Doesn't change anything. And trying to link libcsage.so with pynac makes sage crash at startup.
comment:31 Changed 7 years ago by
It does already link against libpynac due to the magic
# distutils: libraries = pynac gmp
in ginac.pxd
comment:32 Changed 7 years ago by
I'm playing around with marking the pynac templates external in the Sage library (C++11 feature, but unofficial in gcc for a while now). This is one way to avoid the clash. The problems seems that, on redhawk, GiNaC::exprseq
a.k.a. GiNaC::container<std::vector>
is not completely instantiated inside libpynac.so
:
vbraun@redhawk:~/test/pynac/sage$ readelf sW local/lib/libpynac.so  grep _ZN5GiNaC9containerISt6vectorEC.Ev 2014: 0000000000169620 162 FUNC WEAK DEFAULT 12 _ZN5GiNaC9containerISt6vectorEC2Ev 3594: 0000000000169620 162 FUNC WEAK DEFAULT 12 _ZN5GiNaC9containerISt6vectorEC2Ev
vs. on my laptop:
$ readelf sW local/lib/libpynac.so  grep _ZN5GiNaC9containerISt6vectorEC.Ev 468: 000000000017c46e 147 FUNC WEAK DEFAULT 11 _ZN5GiNaC9containerISt6vectorEC2Ev 7994: 000000000017c46e 147 FUNC WEAK DEFAULT 11 _ZN5GiNaC9containerISt6vectorEC1Ev 4012: 000000000017c46e 147 FUNC WEAK DEFAULT 11 _ZN5GiNaC9containerISt6vectorEC2Ev 5629: 000000000017c46e 147 FUNC WEAK DEFAULT 11 _ZN5GiNaC9containerISt6vectorEC1Ev
If you know gcc name mangling by heart (and I don't blame you if you don't) then the C1
is the full constructor while C2
is only the base object constructor. If you use c++filt
then that distinction is not shown (!).
So after marking that template external in ginac_wrap.h
, Sage still works on my lapop but fails on redhawk since the full constructor is never instantiated. I think we should just push explicit instantiation of all necessary templates into pynac, this will probably fix the bug here.
comment:33 Changed 7 years ago by
Implemented in https://bitbucket.org/vbraun/pynac/commits/af5e2c913c4399459a955b7604547941a36df88e
This does fix the issue on redhawk...
comment:34 Changed 7 years ago by
 Commit changed from d6aa8ff7d1381db12a46e38cb9528127623ab346 to fd09d9713ff39eecae117d2591ced0c5ef3e5791
comment:35 Changed 7 years ago by
 Commit changed from fd09d9713ff39eecae117d2591ced0c5ef3e5791 to 0d07667b860634f438007d427353e2833c7ec9af
Branch pushed to git repo; I updated commit sha1. New commits:
0d07667  updated pynac tarball

comment:36 Changed 7 years ago by
 Description modified (diff)
comment:37 Changed 7 years ago by
 Commit changed from 0d07667b860634f438007d427353e2833c7ec9af to c1cf3fc54366d600d84d6a9648eced5034ea10bc
Branch pushed to git repo; I updated commit sha1. New commits:
c1cf3fc  updated to pynac 0.3.2

comment:38 Changed 7 years ago by
 Description modified (diff)
comment:39 Changed 7 years ago by
 Status changed from needs_work to needs_review
comment:40 Changed 7 years ago by
JeanPierre, are you still reviewing this ticket?
comment:41 Changed 7 years ago by
Uh... I wasn't even aware there was a 0.3.2 version of pynac!?
comment:42 Changed 7 years ago by
Well now there is ;) See also pynacdevel...
comment:43 followup: ↓ 47 Changed 7 years ago by
How is the LT_VERSION_INFO problem?
comment:44 Changed 7 years ago by
I don't know what you are talking about. I'm not aware of any libtool versioning problem, but if there is then it has nothing to do with this ticket.
comment:45 followup: ↓ 46 Changed 7 years ago by
I was away from the internet for one week. I'll review that at worst on monday.
comment:46 in reply to: ↑ 45 Changed 7 years ago by
Replying to jpflori:
I was away from the internet for one week.
OMG thats terrible! How did you survive? ;)
comment:47 in reply to: ↑ 43 Changed 7 years ago by
Replying to Snark:
How is the LT_VERSION_INFO problem?
Still here I guess... See last post in https://groups.google.com/d/msg/pynacdevel/nNiFSb1VyKw/F7RJso8RjvwJ
comment:48 Changed 7 years ago by
 Branch changed from u/vbraun/python_tuples_in_SR to u/jpflori/ticket/14780
 Commit changed from c1cf3fc54366d600d84d6a9648eced5034ea10bc to aa7287f676a96f486af609ea36554820e0b3d7bc
 Reviewers changed from Volker Braun to Volker Braun, JeanPierre Flori
 Status changed from needs_review to positive_review
I had a look at the changes in Sage and in Pynac and both look fine (though I cannot completely ensure that some dark magic use of C++ features could still break the templating stuff).
It also compiles fine and passes long tests on a ppc system.
The only change in my branch is a typo correction.
New commits:
aa7287f  Correct typo in sage/symbolic/ring.pyx.

comment:49 Changed 7 years ago by
 Branch changed from u/jpflori/ticket/14780 to aa7287f676a96f486af609ea36554820e0b3d7bc
 Resolution set to fixed
 Status changed from positive_review to closed
We were discussing an optional
recursive=[TrueFalse]
keyword argument at SD48. Are you still going to implement this? Similar for the unpacking at #14802.