Problems with subclassing enum34

Robert Kern robert.kern at gmail.com
Fri Jun 28 12:17:40 EDT 2013


On 2013-06-28 16:32, 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.

You may also need to manually deal with the conflict between Enum.__new__() and 
c_int.__new__().

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list