Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thus,': 0.09; 'bug': 0.12; 'enum': 0.16; 'kern': 0.16; 'metaclasses': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:Problems': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'solution.': 0.20; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'interpret': 0.24; 'mention': 0.26; 'skip:_ 20': 0.27; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'forgot': 0.30; 'robert': 0.30; "i'm": 0.30; 'work.': 0.31; 'ctypes': 0.31; 'problem': 0.35; 'subject:with': 0.35; 'but': 0.35; 'there': 0.35; "didn't": 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'skip:_ 30': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'manually': 0.60; 'simply': 0.61; 'our': 0.64; 'chance': 0.65; 'thomas': 0.65; 'world': 0.66; 'between': 0.67; 'believe': 0.68; 'eco': 0.84; 'terrible': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: Problems with subclassing enum34 Date: Fri, 28 Jun 2013 17:17:40 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 213.1.240.226 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372436274 news.xs4all.nl 15964 [2001:888:2000:d::a6]:56667 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49382 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