diff options
| author | Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2025-06-26 18:04:39 +0800 | 
|---|---|---|
| committer | Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2025-06-26 19:30:20 +0800 | 
| commit | e78597aa6a2ff22d3c04b1395d475b64aef4a0aa (patch) | |
| tree | 704e8487aa1800f704b90d935144cfe41f0b048e /math/py-petsc4py/files | |
| parent | math/py-CyLP: Allow build with cython 3.1.0+ (diff) | |
math/py-petsc4py: Allow build with cython 3.1.0+
- Bump PORTREVISION for package change
Obtained from:	https://gitlab.com/petsc/petsc/-/commit/87b0c9e1f4d83439f081eddd06cf19f419b1e4f9
Diffstat (limited to 'math/py-petsc4py/files')
| -rw-r--r-- | math/py-petsc4py/files/patch-cython | 101 | 
1 files changed, 101 insertions, 0 deletions
diff --git a/math/py-petsc4py/files/patch-cython b/math/py-petsc4py/files/patch-cython new file mode 100644 index 000000000000..2fb9419b9dbc --- /dev/null +++ b/math/py-petsc4py/files/patch-cython @@ -0,0 +1,101 @@ +Obtained from:	https://gitlab.com/petsc/petsc/-/commit/87b0c9e1f4d83439f081eddd06cf19f419b1e4f9 + +--- conf/cyautodoc.py.orig	2025-01-29 22:17:46 UTC ++++ conf/cyautodoc.py +@@ -24,8 +24,9 @@ class ExpressionWriter(BaseExpressionWriter): +             self.visit(node.index) +         self.put(']') +  +-    def visit_UnicodeNode(self, node): +-        self.emit_string(node, '') ++    if hasattr(BaseExpressionWriter, 'emit_string'): ++        def visit_UnicodeNode(self, node): ++            self.emit_string(node, '') +  +  + class AnnotationWriter(ExpressionWriter, BaseAnnotationWriter): +--- src/petsc4py/PETSc/petscdm.pxi.orig	2025-01-29 22:17:46 UTC ++++ src/petsc4py/PETSc/petscdm.pxi +@@ -236,9 +236,12 @@ cdef inline PetscInt asBoundary(object boundary, +                                 PetscDMBoundaryType *_z) except -1: +     cdef PetscInt dim = 0 +     cdef object x=None, y=None, z=None ++    # Use `type(0)` instead of `int` to workaround ++    # Cython 3.1 failing to interpret `int` as a type ++    cdef type pyint = type(0) +     if boundary is None or \ +        isinstance(boundary, str) or \ +-       isinstance(boundary, int): ++       isinstance(boundary, pyint): +         _x[0] = _y[0] = _z[0] = asBoundaryType(boundary) +     else: +         _x[0] = _y[0] = _z[0] = DM_BOUNDARY_NONE +--- src/petsc4py/PETSc/petscis.pxi.orig	2025-01-29 22:17:46 UTC ++++ src/petsc4py/PETSc/petscis.pxi +@@ -181,28 +181,6 @@ cdef class _IS_buffer: +     def __exit__(self, *exc): +         return self.exit() +  +-    # buffer interface (legacy) +- +-    cdef Py_ssize_t getbuffer(self, void **p) except -1: +-        cdef PetscInt n = 0 +-        if p != NULL: +-            self.acquire() +-            p[0] = <void*>self.data +-            n = self.size +-        elif self.iset != NULL: +-            CHKERR(ISGetLocalSize(self.iset, &n)) +-        return <Py_ssize_t>(<size_t>n*sizeof(PetscInt)) +- +-    def __getsegcount__(self, Py_ssize_t *lenp): +-        if lenp != NULL: +-            lenp[0] = self.getbuffer(NULL) +-        return 1 +- +-    def __getreadbuffer__(self, Py_ssize_t idx, void **p): +-        if idx != 0: raise SystemError( +-            "accessing non-existent buffer segment") +-        return self.getbuffer(p) +- +     # NumPy array interface (legacy) +  +     property __array_interface__: +--- src/petsc4py/PETSc/petscvec.pxi.orig	2025-01-29 22:17:46 UTC ++++ src/petsc4py/PETSc/petscvec.pxi +@@ -573,35 +573,6 @@ cdef class _Vec_buffer: +     def __exit__(self, *exc): +         return self.exit() +  +-    # buffer interface (legacy) +- +-    cdef Py_ssize_t getbuffer(self, void **p) except -1: +-        cdef PetscInt n = 0 +-        if p != NULL: +-            self.acquire() +-            p[0] = <void*>self.data +-            n = self.size +-        elif self.vec != NULL: +-            CHKERR(VecGetLocalSize(self.vec, &n)) +-        return <Py_ssize_t>(<size_t>n*sizeof(PetscScalar)) +- +-    def __getsegcount__(self, Py_ssize_t *lenp): +-        if lenp != NULL: +-            lenp[0] = self.getbuffer(NULL) +-        return 1 +- +-    def __getreadbuffer__(self, Py_ssize_t idx, void **p): +-        if idx != 0: raise SystemError( +-            "accessing non-existent buffer segment") +-        return self.getbuffer(p) +- +-    def __getwritebuffer__(self, Py_ssize_t idx, void **p): +-        if idx != 0: raise SystemError( +-            "accessing non-existent buffer segment") +-        if self.readonly: raise TypeError( +-            "Object is not writable.") +-        return self.getbuffer(p) +- +     # NumPy array interface (legacy) +  +     property __array_interface__:  | 
