On 7/21/2011 4:14 PM, Robert Bradshaw wrote:
Cython has seen an enormous amount of development since 0.14.1. If you
are not already using the latest version from the development
repository, we encourage you to try out the release candidate:
http://cython.org/release/Cython-0.15rc0.tar.gz
- Robert
Hi,
I get a test error on Windows with msvc9 due to the "with gil" statement
producing invalid C code (at least for msvc9). Below is the offending
code in with_gil.c. Moving the declaration of the __pyx_gilstate_save
variable a couple of lines up fixes this. A patch is attached.
Christoph
/* "with_gil.pyx":347
* raise Exception("This will be overridden")
* finally:
* with gil: # <<<<<<<<<<<<<<
* raise Exception("Override exception!")
*
*/
/*finally:*/ {
int __pyx_why;
PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
int __pyx_exc_lineno;
__pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0;
__pyx_exc_lineno = 0;
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save;
#endif
__pyx_why = 0; goto __pyx_L10;
diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index 2d39240..2312e8d 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -5414,15 +5414,15 @@ class TryFinallyStatNode(StatNode):
code.putln("int __pyx_why;")
if error_label_used and self.preserve_exception:
+ if self.is_try_finally_in_nogil:
+ code.declare_gilstate()
+
code.putln("PyObject *%s, *%s, *%s;" % Naming.exc_vars)
code.putln("int %s;" % Naming.exc_lineno_name)
exc_var_init_zero = ''.join(
["%s = 0; " % var for var in Naming.exc_vars])
exc_var_init_zero += '%s = 0;' % Naming.exc_lineno_name
code.putln(exc_var_init_zero)
-
- if self.is_try_finally_in_nogil:
- code.declare_gilstate()
else:
exc_var_init_zero = None
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel