Issue #9675: better error handling in bsddb

This commit is contained in:
Jesus Cea 2010-11-05 00:13:50 +00:00
parent 33c722b795
commit 84f2c325c3
1 changed files with 15 additions and 2 deletions

View File

@ -9976,8 +9976,21 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
}
#endif
PyDict_SetItemString(d, "api", py_api);
Py_DECREF(py_api);
/* Check error control */
/*
** PyErr_NoMemory();
** py_api = NULL;
*/
if (py_api) {
PyDict_SetItemString(d, "api", py_api);
Py_DECREF(py_api);
} else { /* Something bad happened */
PyErr_WriteUnraisable(m);
PyErr_Warn(PyExc_RuntimeWarning,
"_bsddb/_pybsddb C API will be not available");
PyErr_Clear();
}
/* Check for errors */
if (PyErr_Occurred()) {