|
SystemError: error return without exception set: msg#00002python.pyrex
I think I may have found a bug in pyrex 0.9 on WindowsXP. I'm writing a __setitem__ handler for my extension class. When I run it, I get "SystemError: error return without exception set". Looking at the generated C, I see that __pyx_r is apparently the return value and it is not initialized. It gets set near the bottom of the C function like this: __pyx_L30:; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("fmatrix.fmatrix.__setitem__"); __pyx_r = -1; __pyx_L0:; Py_DECREF(__pyx_v_avalue); Py_DECREF(__pyx_v_r); Py_DECREF(__pyx_v_c); Py_DECREF(__pyx_v_self); Py_DECREF(__pyx_v_key); Py_DECREF(__pyx_v_value); return __pyx_r; I'm guessing that a normal return should goto __pyx_L30, and an error return should goto __pyx_L1. In my pyrex code I say: if PyInt_Check(key): # int index, simple and common i = key if i < 0: i = i + self.len if 0 <= i < self.len: if svalue: self.base[i] = fvalue return else: raise TypeError else: raise IndexError The return gets translated into "goto __pyx_L0;" which skips the initialization of __pyx_r. I verified this by hacking the C code to initialize __pyx_r = 0 when it is declared. Then the function works as expected. So the problem *may* be that __pyx_r was supposed to be set before the goto, or it may be that the goto was supposed to be to __pyx_L30 instead of 0. I can try to boil the code down to the minimum error producing subset if you need it. gb |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Production Pyrex Re: Pyrex at Pycon: 00002, Paul Prescod |
|---|---|
| Next by Date: | [Fwd: Pyrex gets a perfect score.]: 00002, Paul Prescod |
| Previous by Thread: | Re: Production Pyrex Re: Pyrex at Pyconi: 00002, Greg Ewing |
| Next by Thread: | [Fwd: Pyrex gets a perfect score.]: 00002, Paul Prescod |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |