You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the result of the example code given below, I get:
/* "test.pyx":10 * * def f2(x): * f1(False if x is None else x) # <<<<<<<<<<<<<< * * f2(None) */__pyx_t_2= (__pyx_v_x==Py_None);
if (__pyx_t_2) {
__pyx_t_1= ((PyObject*)0);
} else {
__pyx_t_3=__Pyx_PyInt_As_bool(__pyx_v_x); if (unlikely((__pyx_t_3== ((bool)-1)) &&PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L1_error)
__pyx_t_1= ((PyObject*)__pyx_t_3);
}
__pyx_t_4=__pyx_f_4test_f1(((bool)__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1=0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4=0;
So it's taking the bool from the if expression (0 or __pyx_t_3, depending on the branch), and casting it to a PyObject * (__pyx_t_1). Then later it casts the pointer back into a bool to pass it to the function, which works, but afterwards it tries to call __Pyx_DECREF on it, causing a segfault.
Describe the bug
In the result of the example code given below, I get:
So it's taking the bool from the
if
expression (0
or__pyx_t_3
, depending on the branch), and casting it to aPyObject *
(__pyx_t_1
). Then later it casts the pointer back into a bool to pass it to the function, which works, but afterwards it tries to call__Pyx_DECREF
on it, causing a segfault.Code to reproduce the behaviour:
Built with
cython --embed
Expected behaviour
In the C code above,
__pyx_t_1
should be abool
.OS
Linux
Python version
3.9.18
Cython version
3.0.2
Additional context
No response
The text was updated successfully, but these errors were encountered: