#12985: Possible future issues with ECL build with unicode enabled
------------------------------------------------------------------+---------
Reporter: pcpa |
Owner: was
Type: enhancement |
Status: needs_review
Priority: minor |
Milestone: sage-5.1
Component: interfaces |
Resolution:
Keywords: | Work
issues:
Report Upstream: Reported upstream. Developers deny it's a bug. |
Reviewers: François Bissey
Authors: Paulo César Pereira de Andradet | Merged
in:
Dependencies: |
Stopgaps:
------------------------------------------------------------------+---------
Comment (by nbruin):
Isn't this just a case of missed conversions? On line 256 we have
{{{
if ecl_nvalues > 1:
raise RuntimeError, "ECL says:
"+ecl_base_string_pointer_safe(ecl_values(1))
else:
return ecl_values(0)
}}}
(this occurs in `ecl_safe_eval`, `ecl_safe_funcall`, `ecl_safe_apply`) and
none of the patches here seem to touch that line. The second value will be
ECL's error string, which is probably a unicode string if ECL uses
unicode. Two solutions:
* Change the definitions of the LISP routines `sage-safe-eval` and friend
(line 212 and further) to already convert the error message to
base_string, e.g.:
{{{
(defun sage-safe-eval (form)
(handler-case
(values (eval form))
(serious-condition (cnd)
(values nil (si:coerce-to-base-string (princ-to-string
cnd))))))
}}}
I don't think in this case we need to store the reference to
`ecl_values(1)`, because the value itself is in a "last value returned"
buffer by ecl and all we're doing is reaching into it to get a string
pointer and copy it into a python string. No opportunity for ecl to
invalidate the `values` buffer.
* do the conversion in the python routines:
{{{
cdef cl_object ecl_safe_eval(cl_object form) except NULL:
cdef cl_object s
ecl_sig_on()
cl_funcall(2,safe_eval_clobj,form)
ecl_sig_off()
if ecl_nvalues > 1:
s = si_coerce_to_base_string(ecl_values(1))
raise RuntimeError, "ECL says: "+ecl_base_string_pointer_safe(s)
else:
return ecl_values(0)
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12985#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.