[pypy-commit] pypy default: Merge branch 'numpy-ctypes'

rlamy noreply at buildbot.pypy.org
Sun Sep 27 02:02:53 CEST 2015


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r79856:a0d630bd2618
Date: 2015-09-27 01:01 +0100
http://bitbucket.org/pypy/pypy/changeset/a0d630bd2618/

Log:	Merge branch 'numpy-ctypes'

	Add support for ndarray.ctypes property

diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -747,8 +747,12 @@
         return out
 
     def descr_get_ctypes(self, space):
-        raise OperationError(space.w_NotImplementedError, space.wrap(
-            "ctypes not implemented yet"))
+        w_result = space.appexec([self], """(arr):
+            from numpy.core import _internal
+            p_data = arr.__array_interface__['data'][0]
+            return _internal._ctypes(arr, p_data)
+        """)
+        return w_result
 
     def buffer_w(self, space, flags):
         return self.implementation.get_buffer(space, True)


More information about the pypy-commit mailing list