-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Description
This script fails:
import numpy as np
import ctypes
sh = (1, 1)
tmp = np.zeros(sh, np.uint8)
test = ctypes.cast(ctypes.c_void_p(tmp.__array_interface__['data'][0]), ctypes.POINTER(ctypes.c_ubyte))
np.ctypeslib.as_array(test, sh)
python 3.4.2-dbg
numpy==1.10.1
Ubuntu 14.10
- Under release python this code runs without crashes, because of disabled assertions
- Under debug release python asserts failed:
python3.4: ../Objects/abstract.c:2077: PyObject_Call: Assertion '(result != ((void *)0) && !PyErr_Occurred()) || (result == ((void *)0) && PyErr_Occurred())' failed.
Can you please explain why?
P.S. may be it can help:
If sh = (1, 1)
change to sh = 239
:
- Release python will raise
TypeError: shape must be a tuple
- Debug python will also aborts