From fcd83633959d6b8131dfd6f991527eb5ce786c33 Mon Sep 17 00:00:00 2001 From: Yichao Yu <yyc1992@gmail.com> Date: Sat, 10 May 2014 10:37:46 -0400 Subject: [PATCH] Use the documented struct.calcsize to determine machine word size for better pypy support. --- pyopencl/tools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 47c00140..b045fc29 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -42,13 +42,14 @@ from pyopencl.compyte.dtypes import ( # noqa def _register_types(): from pyopencl.compyte.dtypes import _fill_dtype_registry + import struct _fill_dtype_registry(respect_windows=False, include_bool=False) get_or_register_dtype("cfloat_t", np.complex64) get_or_register_dtype("cdouble_t", np.complex128) - is_64_bit = tuple.__itemsize__ * 8 == 64 + is_64_bit = struct.calcsize('@P') * 8 == 64 if not is_64_bit: get_or_register_dtype( ["unsigned long", "unsigned long int"], np.uint64) -- GitLab