Skip to content

Commit 8b699fa

Browse files
lichraybehackett
authored andcommitted
Do not swallow the exceptions from the input iter.
1 parent 845b165 commit 8b699fa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pymongo/_cmessagemodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ static PyObject* _cbson_insert_message(PyObject* self, PyObject* args) {
216216
}
217217
Py_DECREF(iterator);
218218

219+
if (PyErr_Occurred()) {
220+
buffer_free(buffer);
221+
PyMem_Free(collection_name);
222+
return NULL;
223+
}
224+
219225
if (!max_size) {
220226
PyObject* InvalidOperation = _error("InvalidOperation");
221227
PyErr_SetString(InvalidOperation, "cannot do an empty bulk insert");

0 commit comments

Comments
 (0)