[pypy-commit] pypy newmemoryview-app-level: hack to expand the max_ndims past numpy's limit
mattip
pypy.commits at gmail.com
Mon Mar 4 08:11:23 EST 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch: newmemoryview-app-level
Changeset: r96208:eb2e008d2181
Date: 2019-03-04 15:09 +0200
http://bitbucket.org/pypy/pypy/changeset/eb2e008d2181/
Log: hack to expand the max_ndims past numpy's limit
diff --git a/pypy/module/cpyext/parse/cpyext_memoryobject.h b/pypy/module/cpyext/parse/cpyext_memoryobject.h
--- a/pypy/module/cpyext/parse/cpyext_memoryobject.h
+++ b/pypy/module/cpyext/parse/cpyext_memoryobject.h
@@ -1,6 +1,12 @@
/* The struct is declared here but it shouldn't
be considered public. Don't access those fields directly,
use the functions instead! */
+
+
+/* this is wrong, PyMemoryViewObject should use PyObject_VAR_HEAD, and use
+ ob_data[1] to hold the shapes, strides, and offsets for the view. Then
+ we should use specialized allocators (that break the cpyext model) to
+ allocate ob_data = malloc(sizeof(Py_ssize_t) * view.ndims * 3) */
typedef struct {
PyObject_HEAD
Py_buffer view;
diff --git a/pypy/module/cpyext/parse/cpyext_object.h b/pypy/module/cpyext/parse/cpyext_object.h
--- a/pypy/module/cpyext/parse/cpyext_object.h
+++ b/pypy/module/cpyext/parse/cpyext_object.h
@@ -68,7 +68,8 @@
typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **);
/* Py3k buffer interface, adapted for PyPy */
-#define Py_MAX_NDIMS 32
+/* XXX remove this constant, us a PyObject_VAR_HEAD instead */
+#define Py_MAX_NDIMS 36
#define Py_MAX_FMT 128
typedef struct bufferinfo {
void *buf;
More information about the pypy-commit
mailing list