Skip to content

Commit 1a784e1

Browse files
committed
PYTHON-1466 Silence minor complaints from Coverity
Remove useless NULL check as GETSTATE cannot return NULL after successful initialization.
1 parent fde5b86 commit 1a784e1

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

bson/_cbsonmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,8 +2642,8 @@ static PyObject* _elements_to_dict(PyObject* self, const char* string,
26422642
return NULL;
26432643
}
26442644
while (position < max) {
2645-
PyObject* name;
2646-
PyObject* value;
2645+
PyObject* name = NULL;
2646+
PyObject* value = NULL;
26472647
int new_position;
26482648

26492649
new_position = _element_to_dict(

pymongo/_cmessagemodule.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,6 @@ init_cmessage(void)
12931293
PyObject *_cbson = NULL;
12941294
PyObject *c_api_object = NULL;
12951295
PyObject *m = NULL;
1296-
struct module_state *state;
12971296

12981297
/* Store a reference to the _cbson module since it's needed to call some
12991298
* of its functions
@@ -1330,11 +1329,7 @@ init_cmessage(void)
13301329
goto fail;
13311330
}
13321331

1333-
state = GETSTATE(m);
1334-
if (state == NULL) {
1335-
goto fail;
1336-
}
1337-
state->_cbson = _cbson;
1332+
GETSTATE(m)->_cbson = _cbson;
13381333

13391334
Py_DECREF(c_api_object);
13401335

0 commit comments

Comments
 (0)