Tidy up handling of OOM exceptions - Py*_New will call PyErr_NoMemory() internally, so there is no need to call it again here, just correctly handle the NULL return value

This commit is contained in:
Andrew Rogers 2021-05-17 22:50:52 +01:00
commit 4f453e0cde

View file

@ -296,7 +296,6 @@ SwigPyClientData_New(PyObject* obj)
Py_DECREF(data->newraw);
Py_DECREF(data->klass);
free(data);
PyErr_NoMemory();
return 0;
}
} else {
@ -355,10 +354,7 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
if (!sobj->dict)
sobj->dict = PyDict_New();
if (!sobj->dict)
return PyErr_NoMemory();
Py_INCREF(sobj->dict);
Py_XINCREF(sobj->dict);
return sobj->dict;
}