Importing with ctypes in Python: fighting overflows
eryksun at gmail.com
Tue Mar 7 09:11:38 EST 2017
On Tue, Mar 7, 2017 at 12:45 PM, <borysova.mary at gmail.com> wrote:
> Importing with ctypes in Python: fighting overflows:
C int is 32-bit on all platforms currently supported by CPython --
both 32-bit and 64-bit. It's the default result type and the default
integer-argument conversion type in ctypes.
Since themis_status_t is a typedef for a C int, the proper way to
define the constant is as follows:
>>> THEMIS_SCOMPARE_MATCH = ctypes.c_int(0xf0f0f0f0).value
This has ctypes convert the value for you, which will be consistent
with how it converts a themis_status_t result.
More information about the Python-list