#30122 closed defect (fixed)

Fix maxima/ecl unicode handling

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-9.2
Component: packages: standard Keywords:
Cc: gh-mwageringel, nbruin, dimpase, gh-spaghettisalat 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:

Status badges

Description (last modified by mkoeppe)

Follow-up 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 base-string>

The above error is due to a bug in ECL 16.1.2 and 20.4.24:

> (princ-to-string 'ξ)
"Ξ"
> (setf local-table (copy-readtable nil))
> (setf (readtable-case local-table) :invert)
:INVERT
> (let ((*readtable* local-table) (*print-case* :upcase)) (princ-to-string 'ξ))
Cannot coerce string Ξ to a base-string

The above code is from Maxima's PRINT-INVERT-CASE function in commac.lisp.

Upstream issue: https://gitlab.com/embeddable-common-lisp/ecl/-/issues/602

Change History (14)

comment:1 Changed 23 months ago by mkoeppe

  • Description modified (diff)

comment:2 Changed 23 months ago by mkoeppe

  • 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 mkoeppe

  • Report Upstream changed from Reported upstream. No feedback yet. to Reported upstream. Developers acknowledge bug.

comment:4 Changed 22 months ago by mkoeppe

  • 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 mkoeppe

  • Branch set to u/mkoeppe/fix_maxima_ecl_unicode_handling

comment:6 Changed 22 months ago by mkoeppe

  • Commit set to 0ca81ec78a214f2699fb372244ab7af23d32fba6

The patches are commits from the ECL develop branch. I have cherry-picked them to https://github.com/mkoeppe/ecl/tree/20.4.24%2Bsage


Last 10 new commits:

c983523EclObject.str: Handle unicode
f237935ecl_to_python: Handle unicode strings
6f740ebecl_eval: Handle unicode strings
ee97a6dFix infinite recursion when error messages are not base-strings
2d87ee3Merge commit 'f82c716fdf9c6e91a07166d36b6329a15ecfb41d' of git://trac.sagemath.org/sage into t/30106/sage_libs_ecl__fix_unicode_handling
828a727Add doctests
99b894aprint_objects: Handle unicode
59dd62becl_eval: Make docstring raw
1f45ebbMerge branch 't/30106/sage_libs_ecl__fix_unicode_handling' into t/30122/fix_maxima_ecl_unicode_handling
0ca81ecAdd ECL patches for unicode symbol printing

comment:7 Changed 22 months ago by mkoeppe

  • Authors set to Matthias Koeppe
  • Status changed from new to needs_review

comment:8 Changed 22 months ago by mkoeppe

sage: var('ξ')._maxima_()
_SAGE_VAR_ξ

comment:9 follow-up: Changed 22 months ago by gh-mwageringel

  • 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 git

  • Commit changed from 0ca81ec78a214f2699fb372244ab7af23d32fba6 to da56bb34222684ab6810554aaf90e98ab614f39f

Branch pushed to git repo; I updated commit sha1. New commits:

da56bb3src/sage/symbolic/expression.pyx: Add doctest

comment:11 in reply to: ↑ 9 Changed 22 months ago by mkoeppe

Replying to gh-mwageringel:

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 gh-mwageringel

  • Status changed from needs_review to positive_review

comment:13 Changed 22 months ago by mkoeppe

Thanks!

comment:14 Changed 22 months ago by vbraun

  • Branch changed from u/mkoeppe/fix_maxima_ecl_unicode_handling to da56bb34222684ab6810554aaf90e98ab614f39f
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.