On 06/28/2013 08:32 AM, Thomas Heller wrote:
Am 28.06.2013 17:25, schrieb Thomas Heller:
Robert Kern:


enum.EnumMeta uses super() in its __new__() implementation but
_ctypes.PyCSimpleType doesn't. Thus, only
_ctypes.PyCSimpleType.__new__() gets a chance to run. Switching the
order of the two might work.


Robert found the problem but I'm unsure if there is a solution.
Also I'm unsure whether this is a bug in ctypes or in enum or if
they are simply incompatible.

I forgot to mention that switching the order of metaclasses didn't work.

Here's the traceback:

Traceback (most recent call last):
  File "ct.py", line 7, in <module>
    class MyEnum(ctypes.c_int, Enum):
  File "/home/ethan/source/enum/enum/py2_enum.py", line 149, in __new__
    enum_class = super(EnumMeta, metacls).__new__(metacls, cls, bases, 
classdict)
TypeError: Error when calling the metaclass bases
    _ctypes.PyCSimpleType.__new__(MyEnum_meta) is not safe, use type.__new__()

Not sure how to fix that.

--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to