[issue887237] Machine integers

Alexander Belopolsky report at bugs.python.org
Wed Dec 10 22:28:08 CET 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> 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?

For the intended purpose of giving access to raw machine arithmetics, I 
would think a C implementation would be required, but Theller's patch is 
a good start.

> One difficulty with the patch is that the original ctypes code
> contained a tp_as_number ...

This can be solved by changing the order of bases for c_<type> classes.  
See attached.

The next step would be to rewrite _NumberMixin in C.  C code can be 
limited to methods operating on known c_ types, say ll_add(x, y) to add 
two longs and hl_cast(x) to cast short to long with python code taking 
care of the dispatch.  (What's the latest on the multiple dispatch, BTW?
)

----------
nosy: +belopolsky

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue887237>
_______________________________________


More information about the Python-bugs-list mailing list