[IronPython] UnicodeError's object attribute

Sanghyeon Seo sanxiyn at gmail.com
Mon Nov 20 11:52:47 CET 2006

Run test.py.

UnicodeError objects don't have "object" attribute. It turns out that,
they have, "@object" attribute instead!

(To Mono users who don't get the same result: it's normal. Mono
ignores .NET encoding/decoding fallbacks, so Python codec error
handling callbacks are completely broken on Mono. I should file a bug
report on this, but bah, I am lazy.)




AttributeError: 'instance' object has no attribute 'object'

# test.py

def handler(exc):
    print repr(exc.object)
    return u'', exc.end

import _codecs
_codecs.register_error('example', handler)

text = unichr(0xac00)
encoded = text.encode('ascii', 'example')
print repr(encoded)

Seo Sanghyeon

More information about the Ironpython-users mailing list