Re: Resource freeing

Greg Ewing <[email protected]> Thu, 20 Nov 2008 13:02:11 +1300
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
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