From 8ee2dec166b5a27b16af687abef86e0accf31096 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 25 Apr 2018 12:59:46 -0400 Subject: [PATCH] Fallback to raw object when converting a sequence fails This happens with Pandas data frames. --- src/python2js.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python2js.cpp b/src/python2js.cpp index d8c29a7b6..7e8a0528a 100644 --- a/src/python2js.cpp +++ b/src/python2js.cpp @@ -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("push", pythonToJs(item)); Py_DECREF(item);