--- class.cpp 2015-09-02 08:07:49.000000000 -0400 +++ class-new.cpp 2016-01-16 12:30:22.000000000 -0500 @@ -308,6 +308,23 @@ ((objects::instance<>*)self)->objects = this; } +// Uninstall the instance data for a C++ object into a Python instance +// object. +void instance_holder::uninstall(PyObject* self) throw() +{ + assert(self->ob_type->ob_type == &class_metatype_object); + instance_holder **chain = &(((objects::instance<>*)self)->objects); + + // iterate through, looking for the pointer that points to this + while ( *chain && *chain != this ) + chain = &((*chain)->m_next); + + // set that pointer to point to the m_next + if (*chain) + *chain = m_next; + + m_next = 0; +} namespace objects {