[Python-checkins] r86180 - python/branches/release27-maint/Modules/_bsddb.c

jesus.cea python-checkins at python.org
Fri Nov 5 01:13:50 CET 2010


Author: jesus.cea
Date: Fri Nov  5 01:13:50 2010
New Revision: 86180

Log:
Issue #9675: better error handling in bsddb

Modified:
   python/branches/release27-maint/Modules/_bsddb.c

Modified: python/branches/release27-maint/Modules/_bsddb.c
==============================================================================
--- python/branches/release27-maint/Modules/_bsddb.c	(original)
+++ python/branches/release27-maint/Modules/_bsddb.c	Fri Nov  5 01:13:50 2010
@@ -9976,8 +9976,21 @@
     }
 #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()) {


More information about the Python-checkins mailing list