What is this 'bad:' label generated by Cython?
While cythonizing my Cython source code files, I can see a dozen of warnings about a label named 'bad:' generated by Cython, for example:
read_input.cpp:30037:3: warning: label ‘bad’ defined but not used [-Wunused-label]
The C++ generated function is like this:
static PyObject* __pyx_convert__to_py_struct__VehicleCaps(struct VehicleCaps s) {
PyObject* res;
PyObject* member;
res = __Pyx_PyDict_NewPresized(0); if (unlikely(!res)) return NULL;
return res;
bad:
Py_XDECREF(member);
Py_DECREF(res);
return NULL;
}
The 'bad:' label is in there, I don't get it why Cython is generating this unused label and it shows warnings.
Do I have really fix these warnings? or it's safe to leave them untouched?
Solution 1:
It's for goto bad
if something fails in the function, but it doesn't look like anything can fail, so it's unused.
It isn't a problem so you can ignore it. But Cython generally tries not to generate unused labels, so feel free to report it as a (small) bug