[pypy-dev] Weird Unicode errors

Timothy Baldridge tbaldridge at gmail.com
Sat Oct 18 22:08:20 CEST 2014


My interpreter is built using mostly unicode for symbols and strings, but
recently I've been getting some really weird translation errors. The first
is this: https://gist.github.com/halgari/0d57dd87434968561705

I tracked this error down to being caused whenever I try an isinstance of
unicode like this:

isinstance(x, unicode)

This is really annoying as I'd love to have a single unified wrap function:

    @specialize.argtype(0)
    def wrap(x):
        if isinstance(x, int):
            return numbers.Integer(x)
        if isinstance(x, unicode):
            return String(x)


And as of this morning I started getting errors like this:

[translation:ERROR] TyperError: don't know how to convert from <UnicodeRepr
* GcStruct rpy_unicode { hash, chars }> to <UniCharRepr UniChar>
[translation:ERROR] .. (pixie.vm.reader:47)PromptReader.read
[translation:ERROR] .. block at 82 with 1 exits
[translation:ERROR] .. v235 = simple_call(v234)

What is a UniChar? My code only deals with unicode strings, so I'm not sure
what's happening here.

Thanks for any help. I've had unicode working perfectly with my interpreter
for weeks, and suddenly in the past two days I've started getting these
errors.

Timothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20141018/051f6151/attachment.html>


More information about the pypy-dev mailing list