| Summary: | Make sagemath backend compatible with sagemath built with python3 | ||
|---|---|---|---|
| Product: | [Applications] cantor | Reporter: | pcpa <paulo.cesar.pereira.de.andrade> |
| Component: | sage-backend | Assignee: | Nikita Sirgienko <warquark> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | warquark |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/kde/cantor/commit/802fb9f44fa95614a8bb0872ea1b4cc485913d82 | Version Fixed/Implemented In: | 19.12.0 |
| Sentry Crash Report: | |||
| Attachments: | cantor-sagemath-python3.patch | ||
Hi First, if you are familiar with development, then there is phabricator.kde.org for suggestions like this. Second, there is tests for Cantor sage backend, and on my machine (SageMath 8.7 based on python2) one of them is failed (TestSage::testPlot(), testsage.cpp::92). So, on this moment, I can't accept the patch, because it breaks appearing of plots appearing for SageMath, based on python2. But, anyway, this problem is important, so, if this patch won't be improved for working with Python2, I think, I just will add a option "SageMath python 3 compatibility". (In reply to Nikita Sirgienko from comment #1) > Hi > > First, if you are familiar with development, then there is > phabricator.kde.org for suggestions like this. > Second, there is tests for Cantor sage backend, and on my machine (SageMath > 8.7 based on python2) one of them is failed (TestSage::testPlot(), > testsage.cpp::92). > > So, on this moment, I can't accept the patch, because it breaks appearing of > plots appearing for SageMath, based on python2. > > But, anyway, this problem is important, so, if this patch won't be improved > for working with Python2, I think, I just will add a option "SageMath python > 3 compatibility". Many thanks for checking it. I am not much familiar with phabricator.kde.org For some reason, while working on parallel with several issues related to the sagemath rpm package, when submitting the report I though the patch could be simplified, but it cannot. The proper line for two arguments would be: print("%s %s" % ('____TMP_DIR____', sage.misc.misc.SAGE_TMP)) python2 would generate different output. For example: $ python2 -c 'print("foo", "bar")' ('foo', 'bar') $ python3 -c 'print("foo", "bar")' foo bar $ python2 -c 'print("%s %s" % ("foo", "bar"))' foo bar I was actually testing a patch with the later version, but got confused and for some reason thought it could be simplified. Egh, sory for delay, my email have lost a mail about your comment.
So, with line
print("%s %s" % ('____TMP_DIR____', sage.misc.misc.SAGE_TMP))
all tests works fine, so you want this changes to Cantor source code, right?
Hi, Yes, it would be a good change to cantor. This change will make cantor work if sagemath is built with python3 or python2. Currently upstream is building with python2, but is finishing porting to python3. I believe currently only the latest Fedora sagemath packages are built with python3. Git commit 802fb9f44fa95614a8bb0872ea1b4cc485913d82 by Nikita Sirgienko. Committed on 05/12/2019 at 22:56. Pushed by sirgienko into branch 'release/19.12'. Add compatibility with Sage based on Python3 FIXED-IN: 19.12.1 M +2 -2 src/backends/sage/sagesession.cpp https://invent.kde.org/kde/cantor/commit/802fb9f44fa95614a8bb0872ea1b4cc485913d82 |
Created attachment 122512 [details] cantor-sagemath-python3.patch I am working on some updates to the Fedora sagemath package. This attached patch works with both, python2 and python3. The reason of the patch is self described below: $ python3 -c 'print 1, 2' File "<string>", line 1 print 1, 2 ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(1, 2)? $ python3 -c 'print(1, 2)' 1 2