Hi again,
another minor problem I've stumbled upon - when I call an "except +" function
in a cdef ... nogil function, gcc fails to compile the .cpp file. Perhaps a
missing PyThreadState *_save; declaration in case of nogil functions?
Cython 0.18b1 3e37475ec5098eef2c421.
Attached patch trivially extends cpp_exceptions_nogil test to show the
problem.
Cheers,
Matěj
>From 3e37475ec5098eef2c4215df13bda6d740a1f942 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= <ma...@laitl.cz>
Date: Tue, 22 Jan 2013 14:52:31 +0100
Subject: [PATCH] Extend cpp_exceptions_nogil test with nogil cdef function
that catches C++ exception
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
To test that this wrong-code-generated bug is fixed:
cpp_exceptions_nogil.cpp: In function ‘int __pyx_f_20cpp_exceptions_nogil_foo_nogil(int)’:
cpp_exceptions_nogil.cpp:630:58: error: ‘_save’ was not declared in this scope
---
tests/run/cpp_exceptions_nogil.pyx | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/run/cpp_exceptions_nogil.pyx b/tests/run/cpp_exceptions_nogil.pyx
index 49acad9..37fd611 100644
--- a/tests/run/cpp_exceptions_nogil.pyx
+++ b/tests/run/cpp_exceptions_nogil.pyx
@@ -8,6 +8,9 @@ cdef extern from "cpp_exceptions_nogil_helper.h" nogil:
cdef void bar "foo"(int i) except +ValueError
cdef void spam"foo"(int i) except +raise_TypeError
+cdef int foo_nogil(int i) nogil except *:
+ foo(i)
+
def test_foo():
"""
>>> test_foo()
@@ -15,9 +18,11 @@ def test_foo():
#
foo(0)
foo(0)
+ foo_nogil(0)
with nogil:
foo(0)
foo(0)
+ foo_nogil(0)
#
try:
with nogil:
--
1.7.12.4
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel