[Pyrex] Resource freeing

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Nov 20 01:02:11 CET 2008


Anders Waldenborg wrote:
> "ret = x + 1" translates into:
> 
>    /* "/tmp/pyrex-rl/test.pyx":10 */
>    __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = 
> __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
>    __pyx_2 = PyNumber_Add(__pyx_v_x, __pyx_1); if (!__pyx_2) 
> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
> ...
> 
> Which will contains two gotos that will skip over the free call.

Use a try-finally block.

-- 
Greg



More information about the Pyrex mailing list