[Python-Dev] Python-Dev Digest, Vol 125, Issue 5
fil at pobox.com
Fri Dec 6 02:31:07 CET 2013
> I've found that libffi does support this type, but sadly ctypes and cffi
> > not. Adding to ctypes does not seem to be trivial, since the description
> > an integer type is limited to a single character ("q" in the case of long
> > long). "q" is considered to be a length of 8, whereas what I really want
> > the integer type "ll" which is correctly considered length of 16.
> Aren't you talking about the struct module? In ctypes, it seems it
> would be sufficient to add a "c_int128" type (and/or "c_uint128").
Adding a c_int128 type seems somewhat non trivial though. The
specific-sized c_intX types are assigned to the named equivalents (c_long
etc.). Getting a named type that equates to 128-bit (on OSX at least
anyway) is the problem.
_type_ = "?"
The type "q" seems to relate to "long long" ("q"uad word?) - but that has a
size of 8 for me. I don't know: what "something" should be, and what "?"
I am guessing stay away from the "long long long" schenanigans and just
define c_int128 directly:
_type_ = "?"
.. but there still seems to lack a _type_ that will relate to a 128-bit
OK, it seems that adding a new "?" that relates to 128-bit requires the
change to struct module. This seems to be in lib-dynload and is written in
C not python?
> Can anyone give me some pointers as to why this has not been added to
> > and the best line of attack?
> Probably because noone needed it until now?
> We have a comprehensive guide if you want to contribute a patch:
> The first step would be to open an enhancement request on the
> issue tracker, the discussion will then move on there:
> (if you want to enhance both the ctypes and struct modules, please open
> a separate issue for each)
OK, thanks. I had been put off by the "bugs" title since this is an
enhancement.. will do.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev