Re: Segfaults and leaked exceptions in 0.9.9
Claudio Freire <[email protected]> Wed, 31 Jul 2013 15:41:41 -0300
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <CAGTBQpYBqS9sYK07h0K4mgtZOtn+k1-W_Jsaw7emn9vkdwrEgA@mail.gmail.com> |
On Wed, Jul 31, 2013 at 3:33 PM, Claudio Freire <[email protected]> wr= ote: > This is interestingly new (I think this didn't happen in 0.9.8, but I > didn't check) > > test.pyx: > ... > . def bork(): > . cdef object rv > . try: > . rv =3D {}[3] > . except: > . rv =3D None > . return rv ... >>>> import lrucache >>>> lrucache.bork() >>>> 3 > KeyError: 3 I should mention that, checking the generated C source, the problem there lies in pyrex not calling PyErr_Clear at the end of the except block. Not calling it is safe as long as the exception has been thrown by pyrex itself, but in this case, it's python that does, so python does set the thread's exception state, and pyrex fails to clean up.