summaryrefslogtreecommitdiff
path: root/tests/errors
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@users.noreply.github.com>2022-12-03 20:22:01 +0100
committerGitHub <noreply@github.com>2022-12-03 19:22:01 +0000
commit099faf83e4f5cc351496afef300853e9b2a57ac0 (patch)
tree2eee568247fe27f5eb2be752d25fff860a23d159 /tests/errors
parent026ce36940e748a38f4f5f747a01713aa9de77c5 (diff)
downloadcython-099faf83e4f5cc351496afef300853e9b2a57ac0.tar.gz
Relax `nogil_check()` of `SliceIndexNode` to support array initialisation (#5142)
Relax `nogil_check()` of `SliceIndexNode` to support array initialisation * Ensure GIL when calling PyErr_Format
Diffstat (limited to 'tests/errors')
-rw-r--r--tests/errors/nogil.pyx13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/errors/nogil.pyx b/tests/errors/nogil.pyx
index dfdebeebd..1fa323b69 100644
--- a/tests/errors/nogil.pyx
+++ b/tests/errors/nogil.pyx
@@ -97,6 +97,15 @@ cdef int fstrings(int x, object obj) except -1 nogil:
f"{x}"
f"{obj}"
+cdef void slice_array() nogil:
+ with gil:
+ b = [1, 2, 3, 4]
+ cdef int[4] a = b[:]
+
+cdef int[:] main() nogil:
+ cdef int[4] a = [1,2,3,4]
+ return a
+
_ERRORS = u"""
4:5: Function with Python return type cannot be declared nogil
@@ -169,4 +178,8 @@ _ERRORS = u"""
97:6: String formatting not allowed without gil
98:4: Discarding owned Python object not allowed without gil
98:6: String formatting not allowed without gil
+
+103:21: Coercion from Python not allowed without the GIL
+103:21: Slicing Python object not allowed without gil
+107:11: Operation not allowed without gil
"""