diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index a05c4487e4..76c7add700 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -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 ------------------------ diff --git a/panda/src/pgraph/nodePathCollection_ext.cxx b/panda/src/pgraph/nodePathCollection_ext.cxx index 48898fb547..0f8c8cdc4a 100644 --- a/panda/src/pgraph/nodePathCollection_ext.cxx +++ b/panda/src/pgraph/nodePathCollection_ext.cxx @@ -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); } ////////////////////////////////////////////////////////////////////