Opened 23 months ago
Closed 22 months ago
#30122 closed defect (fixed)
Fix maxima/ecl unicode handling
Reported by:  mkoeppe  Owned by:  

Priority:  major  Milestone:  sage9.2 
Component:  packages: standard  Keywords:  
Cc:  ghmwageringel, nbruin, dimpase, ghspaghettisalat  Merged in:  
Authors:  Matthias Koeppe  Reviewers:  Markus Wageringel 
Report Upstream:  Fixed upstream, but not in a stable release.  Work issues:  
Branch:  da56bb3 (Commits, GitHub, GitLab)  Commit:  da56bb34222684ab6810554aaf90e98ab614f39f 
Dependencies:  #30106, #22191  Stopgaps: 
Description (last modified by )
Followup from #30106, where the following was observed:
sage: var('ξ')._maxima_() ....: <repr(<sage.interfaces.maxima_lib.MaximaLibElement at 0x32c1d4828>) failed: RuntimeError: ECL says: Cannot coerce string $_SAGE_VAR_ξ to a basestring>
The above error is due to a bug in ECL 16.1.2 and 20.4.24:
> (princtostring 'ξ) "Ξ" > (setf localtable (copyreadtable nil)) > (setf (readtablecase localtable) :invert) :INVERT > (let ((*readtable* localtable) (*printcase* :upcase)) (princtostring 'ξ)) Cannot coerce string Ξ to a basestring
The above code is from Maxima's PRINTINVERTCASE
function in commac.lisp.
Upstream issue: https://gitlab.com/embeddablecommonlisp/ecl//issues/602
Change History (14)
comment:1 Changed 23 months ago by
 Description modified (diff)
comment:2 Changed 23 months ago by
 Description modified (diff)
 Report Upstream changed from Not yet reported upstream; Will do shortly. to Reported upstream. No feedback yet.
comment:3 Changed 22 months ago by
 Report Upstream changed from Reported upstream. No feedback yet. to Reported upstream. Developers acknowledge bug.
comment:4 Changed 22 months ago by
 Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, but not in a stable release.
comment:5 Changed 22 months ago by
 Branch set to u/mkoeppe/fix_maxima_ecl_unicode_handling
comment:6 Changed 22 months ago by
 Commit set to 0ca81ec78a214f2699fb372244ab7af23d32fba6
comment:7 Changed 22 months ago by
 Status changed from new to needs_review
comment:8 Changed 22 months ago by
sage: var('ξ')._maxima_() _SAGE_VAR_ξ
comment:9 followup: ↓ 11 Changed 22 months ago by
 Reviewers set to Markus Wageringel
This is great. As far as I can tell, this works correctly now. We should add a doctest, but otherwise this looks good to me.
Somewhat surprisingly, this also seems to fix the conversion to Giac:
sage: var('α')._giac_() N1 # before α # after
but there is another issue with the Giac interface, for which I have opened #30133.
comment:10 Changed 22 months ago by
 Commit changed from 0ca81ec78a214f2699fb372244ab7af23d32fba6 to da56bb34222684ab6810554aaf90e98ab614f39f
Branch pushed to git repo; I updated commit sha1. New commits:
da56bb3  src/sage/symbolic/expression.pyx: Add doctest

comment:11 in reply to: ↑ 9 Changed 22 months ago by
Replying to ghmwageringel:
Somewhat surprisingly, this also seems to fix the conversion to Giac
Yes, everything depends on everything in Sage
comment:12 Changed 22 months ago by
 Status changed from needs_review to positive_review
comment:13 Changed 22 months ago by
Thanks!
comment:14 Changed 22 months ago by
 Branch changed from u/mkoeppe/fix_maxima_ecl_unicode_handling to da56bb34222684ab6810554aaf90e98ab614f39f
 Resolution set to fixed
 Status changed from positive_review to closed
The patches are commits from the ECL
develop
branch. I have cherrypicked them to https://github.com/mkoeppe/ecl/tree/20.4.24%2BsageLast 10 new commits:
EclObject.str: Handle unicode
ecl_to_python: Handle unicode strings
ecl_eval: Handle unicode strings
Fix infinite recursion when error messages are not basestrings
Merge commit 'f82c716fdf9c6e91a07166d36b6329a15ecfb41d' of git://trac.sagemath.org/sage into t/30106/sage_libs_ecl__fix_unicode_handling
Add doctests
print_objects: Handle unicode
ecl_eval: Make docstring raw
Merge branch 't/30106/sage_libs_ecl__fix_unicode_handling' into t/30122/fix_maxima_ecl_unicode_handling
Add ECL patches for unicode symbol printing