On 22 September 2010 13:38, Stephane DROUARD <[email protected]> wrote:
>
> Note that you can restore at the end of the /*try:*/ block, instead of in the 
> /*finally:*/ block:
>
>  { PyThreadState *_save;
>    Py_UNBLOCK_THREADS
>    /*try:*/ {
>      try {foo();} catch(...) {Py_BLOCK_THREADS __Pyx_CppExn2PyErr(); 
> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; 
> goto __pyx_L6;}}
>      Py_BLOCK_THREADS
>    }
>    /*finally:*/ {
>      int __pyx_why;
>      __pyx_why = 0; goto __pyx_L7;
>      __pyx_L6: __pyx_why = 4; goto __pyx_L7;
>      __pyx_L7:;
>      switch (__pyx_why) {
>        case 4: goto __pyx_L1_error;
>      }
>    }
>  }
>
> (it's exactly equivalent to my original proposal, but maybe cleaner that 
> way...)
>

Sorry, I'm still confused. In case of errors, your code does
Py_BLOCK_THREADS twice! Is that fine? Isn't a matching
Py_UNBLOCK_THREADS required after __Pyx_CppExn2PyErr()? In short, is
the pure C code below right?

Py_BLOCK_THREADS
foo()
Py_UNBLOCK_THREADS
Py_UNBLOCK_THREADS


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to