Skip to content

Commit f252a7c

Browse files
committed
PYTHON-3959 - NULL Initialize PyObjects
Missed a few, thanks Jib!
1 parent 127ce23 commit f252a7c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bson/_cbsonmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,8 +2512,8 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
25122512
* Wrap any non-InvalidBSON errors in InvalidBSON.
25132513
*/
25142514
if (PyErr_Occurred()) {
2515-
PyObject *etype, *evalue, *etrace;
2516-
PyObject *InvalidBSON;
2515+
PyObject *etype = NULL, *evalue = NULL, *etrace = NULL;
2516+
PyObject *InvalidBSON = NULL;
25172517

25182518
/*
25192519
* Calling _error clears the error state, so fetch it first.
@@ -2585,8 +2585,8 @@ static int _element_to_dict(PyObject* self, const char* string,
25852585
if (!*name) {
25862586
/* If NULL is returned then wrap the UnicodeDecodeError
25872587
in an InvalidBSON error */
2588-
PyObject *etype, *evalue, *etrace;
2589-
PyObject *InvalidBSON;
2588+
PyObject *etype = NULL, *evalue = NULL, *etrace = NULL;
2589+
PyObject *InvalidBSON = NULL;
25902590

25912591
PyErr_Fetch(&etype, &evalue, &etrace);
25922592
if (PyErr_GivenExceptionMatches(etype, PyExc_Exception)) {

pymongo/_cmessagemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct module_state {
3131
PyObject* _max_bson_size_str;
3232
PyObject* _max_message_size_str;
3333
PyObject* _max_write_batch_size_str;
34-
PyObject* _max_split_size_str;
34+
PyObject* _max_split_size_str;
3535
};
3636

3737
/* See comments about module initialization in _cbsonmodule.c */

0 commit comments

Comments
 (0)