From 03f01774faff5b4b1979f821e66d5732bea261c0 Mon Sep 17 00:00:00 2001 From: aherlihy Date: Fri, 13 Nov 2015 10:57:15 -0500 Subject: [PATCH] PYTHON-1010 write_dict now checks the error indicator when exiting iteration loop --- bson/_cbsonmodule.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c index a78965695..ada7bee0f 100644 --- a/bson/_cbsonmodule.c +++ b/bson/_cbsonmodule.c @@ -1378,6 +1378,9 @@ int write_dict(PyObject* self, buffer_t buffer, Py_DECREF(key); } Py_DECREF(iter); + if (PyErr_Occurred()) { + return 0; + } /* write null byte and fill in length */ if (!buffer_write_bytes(buffer, &zero, 1)) {