Fallback to raw object when converting a sequence fails

This happens with Pandas data frames.
This commit is contained in:
Michael Droettboom 2018-04-25 12:59:46 -04:00
parent 420bdcda7e
commit 8ee2dec166
1 changed files with 3 additions and 1 deletions

View File

@ -114,7 +114,9 @@ val pythonToJs(PyObject *x) {
for (size_t i = 0; i < length; ++i) {
PyObject *item = PySequence_GetItem(x, i);
if (item == NULL) {
return pythonExcToJs();
// If something goes wrong converting the sequence, fallback to the Python proxy
PyErr_Clear();
return val(Py(x));
}
x_array.call<int>("push", pythonToJs(item));
Py_DECREF(item);