Fix exception when trying to pickle NodePathCollection objects

This commit is contained in:
rdb 2016-10-31 22:07:01 +01:00
parent c822fb57af
commit 4526de8f7a
2 changed files with 8 additions and 4 deletions

View File

@ -45,6 +45,7 @@ This issue fixes several bugs that were still found in 1.9.2.
* Fix rare X11 .ico cursor bug; also now supports PNG-compressed icons
* Add keyword argument support to make() methods such as Shader.make()
* Fix compilation errors with Bullet 2.84
* Fix exception when trying to pickle NodePathCollection objects
------------------------ RELEASE 1.9.2 ------------------------

View File

@ -84,16 +84,19 @@ __reduce__(PyObject *self) const {
// (e.g. this), and the arguments necessary to reconstruct this
// object.
PyObject *this_class = PyObject_Type(self);
PyObject *this_class = (PyObject *)self->ob_type;
if (this_class == NULL) {
return NULL;
}
PyObject *self_iter = PyObject_GetIter(self);
if (self_iter == NULL) {
return NULL;
}
// Since a NodePathCollection is itself an iterator, we can simply
// pass it as the fourth tuple component.
PyObject *result = Py_BuildValue("(O()OO)", this_class, Py_None, self);
Py_DECREF(this_class);
return result;
return Py_BuildValue("(O()ON)", this_class, Py_None, self_iter);
}
////////////////////////////////////////////////////////////////////