[Python-Dev] 128 bit integer support

Antoine Pitrou solipsis at pitrou.net
Wed Dec 4 15:15:42 CET 2013

Hi Fil,

On Wed, 4 Dec 2013 23:17:11 +1100
Fil Mackay <fil at pobox.com> wrote:
> I've found that libffi does support this type, but sadly ctypes and cffi do
> not. Adding to ctypes does not seem to be trivial, since the description of
> 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 is
> 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").

> These musings are on OSX.
> Can anyone give me some pointers as to why this has not been added to date,
> 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)



More information about the Python-Dev mailing list