Skip to content

Commit 07f5fb5

Browse files
author
Mike Dirolf
committed
float and none c encoders
1 parent ff8a591 commit 07f5fb5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pymongo/_cbsonmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ static PyObject* _cbson_element_to_bson(PyObject* self, PyObject* args) {
135135
long bool = PyInt_AsLong(value);
136136
char c = bool ? 0x01 : 0x00;
137137
return build_element(0x08, name, 1, &c);
138+
} else if (PyFloat_CheckExact(value)) {
139+
double d = PyFloat_AsDouble(value);
140+
return build_element(0x01, name, 8, (char*)&d);
141+
} else if (value == Py_None) {
142+
return build_element(0x0A, name, 0, 0);
138143
}
139144
PyErr_SetString(CBSONError, "no c encoder for this type yet");
140145
return NULL;

0 commit comments

Comments
 (0)