On 22 July 2011 04:52, Lisandro Dalcin <dalc...@gmail.com> wrote: > On 21 July 2011 23:43, Christoph Gohlke <cgoh...@uci.edu> wrote: >> >> >> 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; >> >> _______________________________________________ >> cython-devel mailing list >> cython-devel@python.org >> http://mail.python.org/mailman/listinfo/cython-devel >> >> > > Your patch is OK. However now I'm wondering why not to initialize the > exc variables to 0 directly on declaration, like this: > > PyObject *__pyx_exc_type = 0, *__pyx_exc_value =0, *__pyx_exc_tb = 0; > > (anyway, I still prefer declaring the gilstate variable first)
I think the reason for that was to avoid compiler warnings about unused variables in certain cases. Amazing by the way, how it still doesn't support C99. > -- > Lisandro Dalcin > --------------- > CIMEC (INTEC/CONICET-UNL) > Predio CONICET-Santa Fe > Colectora RN 168 Km 472, Paraje El Pozo > 3000 Santa Fe, Argentina > Tel: +54-342-4511594 (ext 1011) > Tel/Fax: +54-342-4511169 > _______________________________________________ > cython-devel mailing list > cython-devel@python.org > http://mail.python.org/mailman/listinfo/cython-devel > _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel