variable. This crushes another memory leak. Slight rewrite
included.
Exception__str__(PyObject* self, PyObject* args)
{
PyObject* out;
- PyObject* tmp;
if (!PyArg_ParseTuple(args, "O", &self))
return NULL;
out = PyString_FromString("");
break;
case 1:
- if (!(tmp = PySequence_GetItem(args, 0)))
- out = NULL;
- else
+ {
+ PyObject* tmp = PySequence_GetItem(args, 0);
+ if (tmp) {
out = PyObject_Str(tmp);
+ Py_DECREF(tmp);
+ }
+ else
+ out = NULL;
break;
+ }
default:
out = PyObject_Str(args);
break;