Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 5e23532f694d by Amaury Forgeot d'Arc in branch '3.2':
Issue #11241: subclasses of ctypes.Array can now be subclassed.
http://hg.python.org/cpython/rev/5e23532f694d
--
nosy: +python-dev
Changes by Amaury Forgeot d'Arc amaur...@gmail.com:
--
resolution: accepted - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11241
Meador Inge mead...@gmail.com added the comment:
Thanks a lot for committing this for me Amaury.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11241
___
Meador Inge mead...@gmail.com added the comment:
This patch was marked as accepted, but it doesn't seem to be committed. Will
someone commit it?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11241
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
Yes, the patch looks good!
--
resolution: - accepted
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11241
___
Meador Inge mead...@gmail.com added the comment:
Amaury, how about this patch? I got rid of querying the type dictionary and
hoisted the creation of the type instance earlier. Then
'PyObject_GetAttrString' can be used to lookup '_length_' and '_type_' by the
regular Python attribute lookup
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
In the patch, _length_ is searched in the class and its base class. But what
happens with a third level?
class my_array3(my_array2):
pass
--
___
Python tracker rep...@bugs.python.org
Meador Inge mead...@gmail.com added the comment:
But what happens with a third level?
That doesn't work. I have a test case for that, but the test case has
a typo that caused it to pass. I will fix the test case and the code.
Thanks.
--
___
Meador Inge mead...@gmail.com added the comment:
Verified that this is still broken in the main development branch.
The base type should be checked for '_type_' or '_length_' before throwing
an error. Attached is a patch that fixes the problem and adds covering
tests. The full test suite
New submission from Steve Thompson steve.f.thomp...@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
10 matches
Mail list logo