]> granicus.if.org Git - python/commitdiff
Fix Coverity # 146. newDBSequenceObject would deref dbobj, so it can't be NULL.
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 11 Jun 2006 05:44:18 +0000 (05:44 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 11 Jun 2006 05:44:18 +0000 (05:44 +0000)
We know it's not NULL from the ParseTuple and DbObject_Check will verify
it's not NULL.

Modules/_bsddb.c

index 04e5af6493437fb6df3ab88133d12f9070c3675c..610451a8be1b30222327ea137707442d4fd76496 100644 (file)
@@ -5560,15 +5560,13 @@ DBEnv_construct(PyObject* self, PyObject* args)
 static PyObject*
 DBSequence_construct(PyObject* self, PyObject* args, PyObject* kwargs)
 {
-    PyObject* dbobj = NULL;
+    PyObject* dbobj;
     int flags = 0;
     static char* kwnames[] = { "db", "flags", NULL};
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:DBSequence", kwnames, &dbobj, &flags))
         return NULL;
-    if (dbobj == Py_None)
-        dbobj = NULL;
-    else if (dbobj && !DBObject_Check(dbobj)) {
+    if (!DBObject_Check(dbobj)) {
         makeTypeError("DB", dbobj);
         return NULL;
     }