Ticket #1189 (closed enhancement: fixed)
[with patch, with positive review] SymPy <-> SAGE automatic conversion
| Reported by: | certik | Owned by: | was |
|---|---|---|---|
| Priority: | major | Milestone: | sage-2.9 |
| Component: | calculus | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
Please update to sympy 0.5.7 using the attached spkg.
Then apply the attached patch that will allow SAGE to freely mix SymPy? and SAGE expressions.
Attachments
Change History
comment:1 Changed 6 years ago by certik
- Type changed from defect to enhancement
- Component changed from algebraic geometry to calculus
Here is the link to the new sympy spkg:
http://dakol.fsik.cvut.cz/~ondra/sympy-0.5.7.spkg
Please update this first, only then use the patch above.
comment:2 Changed 6 years ago by certik
After upgrading the spkg and applying the patch, please check, that everything works as it should by:
$ ./sage -t devel/sage/sage/calculus/test_sympy.py sage -t devel/sage-main/sage/calculus/test_sympy.py
[2.9 s]
All tests passed! Total time for all tests: 2.9 seconds
comment:3 Changed 6 years ago by mabshoff
- Summary changed from update sympy to 0.5.7, patch to make SymPy and SAGE work nicely to [with patch|spkg] update sympy to 0.5.7, patch to make SymPy and SAGE work nicely
- Milestone set to sage-2.8.13
comment:5 Changed 6 years ago by certik
Once again, this time with correct formatting.
Changelog of the spkg:
- Script "get-hg" for getting hg sources added
- "get-orig-sources" updated to download SymPy 0.5.7
Changelog of the patch:
- basic SymPy and SAGE objects can now be freely mixed
comment:6 Changed 6 years ago by mabshoff
- Status changed from new to closed
- Resolution set to fixed
Merged in 2.8.13.alpha0.
comment:7 Changed 6 years ago by mabshoff
Arrg, the bit of the patch in coerce.pyx causes segfaults. So the patch is backed out, but the spkg is still in.
Ondrej: Either open a new ticket and resubmit the patch or reopen this ticket.
Cheers,
Michael
comment:8 Changed 6 years ago by certik
- Status changed from closed to reopened
- Resolution fixed deleted
- Milestone sage-2.8.13 deleted
Oops. I only executed the tests in calculus/test_sympy.py.
I am openning the ticket, but leaving it to a later milestone, because I don't have time at the moment to fix that. Is there someone more experienced to maybe see immediatelly what is wrong?
I run "./sage -t *" and indeed I am getting these errors:
sage -t devel/sage-main/sage/schemes/generic/spec.py sh: line 1: 9143 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_spec.py >.doctest/out 2>.doctest/err
A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.
sage -t devel/sage-main/sage/rings/number_field/order.py sh: line 1: 9354 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_order.py >.doctest/out 2>.doctest/err
A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.
sage -t devel/sage-main/sage/rings/integer_ring.pyx sh: line 1: 9855 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_integer_ring.py >.doctest/out 2>.doctest/err
A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.
sage -t devel/sage-main/sage/rings/complex_field.py sh: line 1: 9919 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_complex_field.py >.doctest/out 2>.doctest/err
A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.
sage -t devel/sage-main/sage/rings/quotient_ring.py sh: line 1: 9934 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_quotient_ring.py >.doctest/out 2>.doctest/err
A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.
sage -t devel/sage-main/sage/rings/polynomial/multi_polynomial_ideal.pysh: line 1: 10028 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_multi_polynomial_ideal.py >.doctest/out 2>.doctest/err
A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.
sage -t devel/sage-main/sage/rings/real_rqdf.pyx sh: line 1: 10557 Segmentation fault /home/ondra/ext/sage-2.8.12-debian32-i686-Linux/local/bin/python .doctest_real_rqdf.py >.doctest/out 2>.doctest/err
A mysterious error (perphaps a memory error?) occurred, which may have crashed doctest.
...
comment:9 Changed 6 years ago by mabshoff
- Summary changed from [with patch|spkg] update sympy to 0.5.7, patch to make SymPy and SAGE work nicely to make SymPy and SAGE work nicely together
- Milestone set to sage-2.9
Hehe, I assumed you ran testall, especially after touching coerce.pyx. I tagged this against 2.9 for now. It will automatically get moved forward every time we complete a milestone.
I also changed the summary to reflect the remaining issue.
Cheers,
Michael
comment:10 Changed 6 years ago by certik
Hehe, I assumed you ran testall, especially after touching coerce.pyx.
Yeah, I am still learning how to properly contribute to SAGE. :)
comment:11 Changed 5 years ago by certik
- Milestone changed from sage-2.9 to sage-2.8.15
The patch was fixed, now it passes all tests:
http://sagetrac.org/sage_trac/attachment/ticket/1189/sympy2.patch
But probably needs some review before committing.
comment:12 Changed 5 years ago by certik
- Summary changed from make SymPy and SAGE work nicely together to [with patch] SymPy <-> SAGE automatic conversion
comment:13 Changed 5 years ago by robertwb
I was not able to apply sympy2.patch cleanly against Sage 2.8.14.
That said, I think _verify_canonical_coercion_c is the wrong thing to call here--please see the attached change which should fix the segfault issue in a much cleaner way and allow stuff like
sage: Integer(1) + sympy.Symbol("x")
x + 1
comment:14 Changed 5 years ago by certik
Unfortunately, I don't have time to do it (leaving to Spain tomorrow). But please use the original sympy.patch + sympy-coerce.patch from Robert, that should do the job.
Thanks a lot.
comment:15 Changed 5 years ago by mabshoff
- Status changed from reopened to closed
- Resolution set to fixed
Merged in 2.8.15.rc0 - finally ;)
comment:16 Changed 5 years ago by mabshoff
- Status changed from closed to reopened
- Resolution fixed deleted
On sage.math the above two patches cause doctest failures in rings/polynomial/multi_polynomial_ideal.py - so reopen.
Cheers,
Michael
comment:17 Changed 5 years ago by mabshoff
- Summary changed from [with patch] SymPy <-> SAGE automatic conversion to [with patch, with negative review] SymPy <-> SAGE automatic conversion
This is probably not the patches direct fault, but we need to fix the other segfault first before merging this. Sage not working on sage.math isn't really an option.
Sorry, Ondrej.
Cheers,
Michael
comment:18 Changed 5 years ago by robertwb
I wasn't able to reproduce the errors in rings/polynomial/multi_polynomial_ideal.py, or anywhere for that matter. Could you clarify?
Still running testall...
comment:19 Changed 5 years ago by robertwb
- Summary changed from [with patch, with negative review] SymPy <-> SAGE automatic conversion to [with patch, with positive review] SymPy <-> SAGE automatic conversion
Testall succeeded for me with these patches.
comment:20 Changed 5 years ago by mabshoff
Well, the segfault happened to me on sage.math.
Cheers,
Michael
comment:21 Changed 5 years ago by mabshoff
- Status changed from reopened to closed
- Resolution set to fixed
Finally merged in 2.9.alpha5 :)

