This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author memeplex
Recipients amaury.forgeotdarc, belopolsky, eryksun, meador.inge, memeplex
Date 2016-07-09.17:36:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468085808.33.0.781393471217.issue27274@psf.upfronthosting.co.za>
In-reply-to
Content
I have been happily using this helper function:

def c_array(*args):
    if type(args[1]) is int:
        ptr, size = args
        return (ptr._type_ * size).from_address(ct.addressof(ptr.contents))
    else:
        c_type, buf = args
        return (c_type * (len(buf) // ct.sizeof(c_type))).from_buffer_copy(buf)

For example:

c_array(ptr_obj, 10)

c_array(c_int, bytes_obj)
History
Date User Action Args
2016-07-09 17:36:48memeplexsetrecipients: + memeplex, amaury.forgeotdarc, belopolsky, meador.inge, eryksun
2016-07-09 17:36:48memeplexsetmessageid: <1468085808.33.0.781393471217.issue27274@psf.upfronthosting.co.za>
2016-07-09 17:36:48memeplexlinkissue27274 messages
2016-07-09 17:36:48memeplexcreate