[New-bugs-announce] [issue11241] ctypes: subclassing an already subclassed ArrayType generates AttributeError
Steve Thompson
report at bugs.python.org
Fri Feb 18 00:59:27 CET 2011
New submission from Steve Thompson <steve.f.thompson at gmail.com>:
Consider the following:
python code:
class my_array( ctypes.Array ):
_type_ = ctypes.c_uint8
_length_ = 256
class my_array2( my_array ):
pass
Output:
class my_array2( my_array ):
AttributeError: class must define a '_length_' attribute, which must be a positive integer
This is analogous to the C code
typedef char my_array[ 256 ];
typedef my_array my_array2;
However, the python code raises exceptions claiming _type_ and _length_ have not been defined. This seems like a bug. I shouldn't need to redefine _type_ and _length_, otherwise there was no point in subclassing my_array.
I tried to step into this using pdb but didn't have any luck.
----------
assignee: theller
components: ctypes
messages: 128769
nosy: Steve.Thompson, theller
priority: normal
severity: normal
status: open
title: ctypes: subclassing an already subclassed ArrayType generates AttributeError
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11241>
_______________________________________
More information about the New-bugs-announce
mailing list