incorrect code order for single type-qualified argument
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cython |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
For methods taking a single, required argument with type qualifier, the code generated will do type conversion first before increment the reference count of the "self" argument (in 0.9.6.12 and later), this can cause reference mis-count should error occur in the type conversion (which will jump to the exit code and decrement the ref count). This does not happen in 0.9.6.11b.
Here is an example:
def setDouble(self, double d):
Code generated:
static PyObject *__pyx_
double __pyx_v_d;
PyObject *__pyx_r;
assert(
__pyx_v_d = __pyx_PyFloat_
}
Py_INCREF(
((struct yCTest *)__pyx_
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
__Pyx_
__pyx_r = NULL;
__pyx_L0:;
Py_DECREF(
return __pyx_r;
}
Fixed and improved the error returned too.