[IronPython] CP Issue #21659: Subclassing unicode

Jeff Hardy jdhardy at gmail.com
Wed Mar 18 01:03:03 CET 2009

On Mon, Mar 16, 2009 at 7:03 PM, Dino Viehland <dinov at microsoft.com> wrote:
> Does this make it work?
> class x(unicode):
>    def __init__(self, val): pass
>    def __new__(cls, val):
>            return unicode.__new__(cls, unicode(val))
> x(1)
> I've voted for the bug and raised the priority to medium.  I've left it proposed until we triage it as a team (we triage bugs every Monday morning so it'll be a week) but I might be able to fix it before then :)

Thanks, that did it. I had to extend it to handle all of the
parameters to unicode:

def __new__(cls, object = '', *args, **kwargs):
        return unicode.__new__(cls, unicode(object), *args, **kwargs)

Only 227 more failures to go (out of 701, so not too bad).

- Jeff

More information about the Ironpython-users mailing list