Improve error message for serialization of custom objects (#359)

* Improve error message for serialization of custom objects

* gitignore numbuf build directory
This commit is contained in:
Philipp Moritz 2016-08-09 13:38:21 -07:00 committed by Johann Schleier-Smith
parent ac36cd6dcd
commit 9903fc0335
2 changed files with 5 additions and 2 deletions

View file

@ -343,7 +343,10 @@ int serialize(PyObject* worker_capsule, PyObject* val, Obj* obj, std::vector<Obj
if (PyObject_IsInstance(*item, (PyObject*) &PyObjectIDType)) {
objectid = ((PyObjectID*) (*item))->id;
} else {
PyErr_SetString(PyExc_TypeError, "must be an object reference"); // TODO: improve error message
std::stringstream ss;
ss << "data type of " << PyString_AS_STRING(PyObject_Repr(*item))
<< " not recognized";
PyErr_SetString(PyExc_TypeError, ss.str().c_str());
return -1;
}
data->add_objectid_data(objectid);

2
thirdparty/numbuf vendored

@ -1 +1 @@
Subproject commit 8e165d43d455925732d5361b79f818b6cead59ca
Subproject commit 7b548bddd337f2358fdf4a042f12c917a29da40d