[issue887237] Machine integers
Thomas Heller
report at bugs.python.org
Sat Nov 15 19:28:09 CET 2008
Thomas Heller <theller at ctypes.org> added the comment:
I wonder if a patch for ctypes like this (which is not yet complete)
could be used to implement this, or MUST it be implemented in C?
The patch contains a mixin class that implements the numeric methods.
However, the actual operation takes place in Python; only the operands
are converted into ctypes types first, the operand is applied to the
value, and the result is converted to a ctypes instance again.
One difficulty with the patch is that the original ctypes code contained
a tp_as_number member where only the nb_nonzero slot was actually
implemented; this prevented the mixin class to do it's work (Python
didn't call the special methods. I wonder if there is a bug somewhere...).
----------
keywords: +patch
Added file: http://bugs.python.org/file12016/ctypes-numbermixins.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue887237>
_______________________________________
More information about the Python-bugs-list
mailing list