Make C and Python _dict_to_bson consistent PYTHON-380

This commit is contained in:
Bernie Hackett 2012-07-23 07:37:04 -07:00
parent 60188ad23e
commit 8ef1bd5daf

View File

@ -1040,9 +1040,11 @@ static PyObject* _cbson_dict_to_bson(PyObject* self, PyObject* args) {
PyObject* result;
unsigned char check_keys;
unsigned char uuid_subtype;
unsigned char top_level = 1;
buffer_t buffer;
if (!PyArg_ParseTuple(args, "Obb", &dict, &check_keys, &uuid_subtype)) {
if (!PyArg_ParseTuple(args, "Obb|b", &dict,
&check_keys, &uuid_subtype, &top_level)) {
return NULL;
}
@ -1052,7 +1054,7 @@ static PyObject* _cbson_dict_to_bson(PyObject* self, PyObject* args) {
return NULL;
}
if (!write_dict(self, buffer, dict, check_keys, uuid_subtype, 1)) {
if (!write_dict(self, buffer, dict, check_keys, uuid_subtype, top_level)) {
buffer_free(buffer);
return NULL;
}