<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Hi Antoine,</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

> I've found that libffi does support this type, but sadly ctypes and cffi do<br>
> not. Adding to ctypes does not seem to be trivial, since the description of<br>
> an integer type is limited to a single character ("q" in the case of long<br>
> long). "q" is considered to be a length of 8, whereas what I really want is<br>
> the integer type "ll" which is correctly considered length of 16.<br>
<br>
Aren't you talking about the struct module? In ctypes, it seems it<br>
would be sufficient to add a "c_int128" type (and/or "c_uint128").<br></blockquote><div><br></div><div>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.<br>

</div><div><br></div><div>The :</div><div><br></div><div><div>class c_something(_SimpleCData):</div><div>    _type_ = "?"</div><div>_check_size(c_something)</div></div><div><br></div><div>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 "?" should be.</div>

<div><br></div><div>I am guessing stay away from the "long long long" schenanigans and just define c_int128 directly:</div><div><br></div><div><div>class c_int128(_SimpleCData):</div><div>    _type_ = "?"</div>

<div><br></div></div><div>.. but there still seems to lack a _type_ that will relate to a 128-bit integer..</div><div><br></div><div>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?</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">> Can anyone give me some pointers as to why this has not been added to date,<br>


> and the best line of attack?<br>
<br>
Probably because noone needed it until now?<br>
<br>
We have a comprehensive guide if you want to contribute a patch:<br>
<a href="http://docs.python.org/devguide/" target="_blank">http://docs.python.org/devguide/</a><br>
<br>
The first step would be to open an enhancement request on the<br>
issue tracker, the discussion will then move on there:<br>
<a href="http://bugs.python.org/" target="_blank">http://bugs.python.org/</a></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
(if you want to enhance both the ctypes and struct modules, please open<br>
a separate issue for each)<br></blockquote><div><br></div><div>OK, thanks. I had been put off by the "bugs" title since this is an enhancement.. will do.</div><div><br></div><div>Regards, Fil.</div><div><br></div>

</div></div></div>