summaryrefslogtreecommitdiff
path: root/numpy/core/_internal.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/_internal.py')
-rw-r--r--numpy/core/_internal.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 82035e561..1100fbf0e 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -8,6 +8,7 @@ from __future__ import division, absolute_import, print_function
import re
import sys
+import platform
from numpy.compat import unicode
from .multiarray import dtype, array, ndarray
@@ -16,6 +17,8 @@ try:
except ImportError:
ctypes = None
+IS_PYPY = platform.python_implementation() == 'PyPy'
+
if (sys.byteorder == 'little'):
_nbo = b'<'
else:
@@ -865,7 +868,10 @@ def npy_ctypes_check(cls):
try:
# ctypes class are new-style, so have an __mro__. This probably fails
# for ctypes classes with multiple inheritance.
- ctype_base = cls.__mro__[-2]
+ if IS_PYPY:
+ ctype_base = cls.__mro__[-3]
+ else:
+ ctype_base = cls.__mro__[-2]
# right now, they're part of the _ctypes module
return 'ctypes' in ctype_base.__module__
except Exception: