bug or feature in enum34 py2.7 backport?

Chris Angelico rosuav at gmail.com
Wed Nov 26 09:40:28 EST 2014


On Thu, Nov 27, 2014 at 1:05 AM,  <random832 at fastmail.us> wrote:
> On Wed, Nov 26, 2014, at 06:29, Mark Summerfield wrote:
>> TypeError: type() argument 1 must be string, not unicode
>
> If this is a bug, maybe it is one in type() itself - I get the same
> error with type('X', (object,), dict(a=1))

I'd say that's a limitation, not a bug. A lot of stuff in Python 2
depends on identifiers being ASCII-only byte strings, including -
apparently - parts of the core code. Suggestion: Switch to Python 3,
or if you can't do that, pass your identifiers through str(). When you
do eventually switch to Py3, that won't do anything, but in Py2, it'll
force them to be byte strings. As long as they are actually
ASCII-only, that'll solve your problem.

ChrisA



More information about the Python-list mailing list