summaryrefslogtreecommitdiff
path: root/tests/errors/cfuncptr.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errors/cfuncptr.pyx')
-rw-r--r--tests/errors/cfuncptr.pyx24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/errors/cfuncptr.pyx b/tests/errors/cfuncptr.pyx
index f07ef2167..9b5f12644 100644
--- a/tests/errors/cfuncptr.pyx
+++ b/tests/errors/cfuncptr.pyx
@@ -18,6 +18,10 @@ cdef extern from *:
# define this as extern since Cython converts internal "except*" to "except -1"
cdef int exceptstar(int bad) except *
+ struct mystruct:
+ int (*func_ptr)(int param) nogil
+ void (*func_ptr_void)(int param) nogil
+
def fail_exceptstar(bad):
cdef int (*fptr_a)(int) noexcept
cdef int (*fptr_b)(int) except -1
@@ -26,11 +30,25 @@ def fail_exceptstar(bad):
fptr_b = exceptstar
fptr_c = exceptstar
+cdef int cb(int param) nogil:
+ return param
+
+cdef void cb_void(int param) except * nogil:
+ return
+
+def fail_struct_pointer():
+ cdef mystruct ms = mystruct(&cb, &cb_void)
+
+
_ERRORS = """
13:13: Cannot assign type 'int (int) except? -2' to 'int (*)(int) except -2'
14:13: Cannot assign type 'int (int) except? -2' to 'int (*)(int) except -1'
15:13: Cannot assign type 'int (int) except? -2' to 'int (*)(int) except? -1'
-25:13: Cannot assign type 'int (int) except *' to 'int (*)(int) noexcept'
-26:13: Cannot assign type 'int (int) except *' to 'int (*)(int) except -1'
-27:13: Cannot assign type 'int (int) except *' to 'int (*)(int) except? -1'
+29:13: Cannot assign type 'int (int) except *' to 'int (*)(int) noexcept'
+30:13: Cannot assign type 'int (int) except *' to 'int (*)(int) except -1'
+31:13: Cannot assign type 'int (int) except *' to 'int (*)(int) except? -1'
+40:32: Cannot assign type 'int (*)(int) except? -1 nogil' to 'int (*)(int) noexcept nogil'
+40:32: Cannot assign type 'int (*)(int) except? -1 nogil' to 'int (*)(int) noexcept nogil'
+40:37: Cannot assign type 'void (*)(int) except * nogil' to 'void (*)(int) noexcept nogil'
+40:37: Cannot assign type 'void (*)(int) except * nogil' to 'void (*)(int) noexcept nogil'
"""