summaryrefslogtreecommitdiff
path: root/tests/errors
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@users.noreply.github.com>2021-12-14 14:49:17 +0100
committerGitHub <noreply@github.com>2021-12-14 14:49:17 +0100
commit6c802335f6079a56b85e503f49f7c99106fe5f4e (patch)
tree3a5e24970f25a7c9b72f705a0975ce43b39cc525 /tests/errors
parented6478f85d63f36ca9f396150781087a032aecdb (diff)
downloadcython-6c802335f6079a56b85e503f49f7c99106fe5f4e.tar.gz
Don't error when exception_check is set to True and return type is PyObject. (GH-4433)
With Cython syntax, we ignore the exception_check when a Python object is returned. In pure Python mode, with a Python object type as return type, we reject it. Instead of raising an error, we now just reset exception_check to False. Found in https://github.com/cython/cython/issues/2529
Diffstat (limited to 'tests/errors')
-rw-r--r--tests/errors/pure_errors.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/errors/pure_errors.py b/tests/errors/pure_errors.py
index 570dc006f..b153bd2e6 100644
--- a/tests/errors/pure_errors.py
+++ b/tests/errors/pure_errors.py
@@ -50,8 +50,15 @@ def pyfunc(x): # invalid
return x + 1
+@cython.exceptval(-1)
+@cython.cfunc
+def test_cdef_return_object_broken(x: object) -> object:
+ return x
+
+
_ERRORS = """
44:22: Calling gil-requiring function not allowed without gil
45:24: Calling gil-requiring function not allowed without gil
48:0: Python functions cannot be declared 'nogil'
+53:0: Exception clause not allowed for function returning Python object
"""