Author hct
Recipients hct
Date 2012-09-28.03:19:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348802344.39.0.86334855376.issue16070@psf.upfronthosting.co.za>
In-reply-to
Content
using official CPython 3.2.3 with a simple demonstration script (attached) to demonstrate inconsistency between ctypes structures

from ctypes import *

class cbs( BigEndianStructure ):
    __slots__ = tuple()
    def __init__( self, *args, **kw ):
        super().__init__( *args, **kw )
        self.a = 11

class cls( LittleEndianStructure ):
    __slots__ = tuple()
    def __init__( self, *args, **kw ):
        super().__init__( *args, **kw )
        self.a = 11

class cs( Structure ):
    __slots__ = tuple()
    def __init__( self, *args, **kw ):
        super().__init__( *args, **kw )
        self.a = 11

try :
    cbs1=cbs()
except AttributeError as e:
    print(e)

try :
    cls1=cls()
except AttributeError as e:
    print(e)

try :
    cs=cs()
except AttributeError as e:
    print(e)



yields

'cls' object has no attribute 'a'
'cs' object has no attribute 'a'



I expect cbs to throw error too, but itwent through the initalization and silently ignored the __slots__ defined in the class
History
Date User Action Args
2012-09-28 03:19:04hctsetrecipients: + hct
2012-09-28 03:19:04hctsetmessageid: <1348802344.39.0.86334855376.issue16070@psf.upfronthosting.co.za>
2012-09-28 03:19:03hctlinkissue16070 messages
2012-09-28 03:19:03hctcreate