forked from pool/python-opengl-accelerate
- Cherry-pick upstream patch to fix build with GCC 14 * https://github.com/mcfletch/pyopengl/pull/112.patch OBS-URL: https://build.opensuse.org/request/show/1178768 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-opengl-accelerate?expand=0&rev=24
55 lines
2.3 KiB
Diff
55 lines
2.3 KiB
Diff
From fbe0fab7947788039cb4fbc9a5a1ea65a0c0e15b Mon Sep 17 00:00:00 2001
|
|
From: Florian Weimer <fweimer@redhat.com>
|
|
Date: Fri, 5 Jan 2024 08:48:12 +0100
|
|
Subject: [PATCH 1/2] accelerate: Fix type of PyArray_FillWithScalar
|
|
|
|
The first argument is of type PyArrayObject, not PyObject.
|
|
---
|
|
accelerate/src/numpy_formathandler.pyx | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/accelerate/src/numpy_formathandler.pyx b/accelerate/src/numpy_formathandler.pyx
|
|
index 0c01d78e..10813694 100644
|
|
--- a/accelerate/src/numpy_formathandler.pyx
|
|
+++ b/accelerate/src/numpy_formathandler.pyx
|
|
@@ -21,7 +21,7 @@ cdef extern from "numpy/arrayobject.h":
|
|
int PyArray_ISCARRAY_RO( np.ndarray instance )
|
|
cdef np.ndarray PyArray_Zeros(int nd, np.Py_intptr_t* dims, np.dtype, int fortran)
|
|
cdef np.ndarray PyArray_EnsureArray(object)
|
|
- cdef int PyArray_FillWithScalar(object, object)
|
|
+ cdef int PyArray_FillWithScalar(np.ndarray, object)
|
|
cdef void import_array()
|
|
cdef void* PyArray_DATA( np.ndarray )
|
|
cdef int PyArray_NDIM( np.ndarray )
|
|
|
|
From f62dd58a5437c628d3ff3e626d4507811ef2127b Mon Sep 17 00:00:00 2001
|
|
From: Florian Weimer <fweimer@redhat.com>
|
|
Date: Fri, 5 Jan 2024 08:48:43 +0100
|
|
Subject: [PATCH 2/2] accelerate: Use recommended way to integrate NumPy with
|
|
Cython
|
|
|
|
This approach follows
|
|
<https://cython.readthedocs.io/en/latest/src/tutorial/numpy.html#adding-types>.
|
|
---
|
|
accelerate/src/numpy_formathandler.pyx | 3 +--
|
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
|
diff --git a/accelerate/src/numpy_formathandler.pyx b/accelerate/src/numpy_formathandler.pyx
|
|
index 10813694..47dacaa0 100644
|
|
--- a/accelerate/src/numpy_formathandler.pyx
|
|
+++ b/accelerate/src/numpy_formathandler.pyx
|
|
@@ -22,7 +22,6 @@ cdef extern from "numpy/arrayobject.h":
|
|
cdef np.ndarray PyArray_Zeros(int nd, np.Py_intptr_t* dims, np.dtype, int fortran)
|
|
cdef np.ndarray PyArray_EnsureArray(object)
|
|
cdef int PyArray_FillWithScalar(np.ndarray, object)
|
|
- cdef void import_array()
|
|
cdef void* PyArray_DATA( np.ndarray )
|
|
cdef int PyArray_NDIM( np.ndarray )
|
|
cdef int *PyArray_DIMS( np.ndarray )
|
|
@@ -226,4 +225,4 @@ cdef class NumpyHandler(FormatHandler):
|
|
|
|
# Cython numpy tutorial neglects to mention this AFAICS
|
|
# get segfaults without it
|
|
-import_array()
|
|
+np.import_array()
|