From 4e17f2620f10677e09b9cb93c7ba8efa703b158b Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Fri, 16 Sep 2011 14:29:25 -0300 Subject: Revert "Implements PSEP-0106 and fixes bug 902 - "Expose Shiboken functionality through a Python module"." This reverts commit bc8448d7fb91733ff08c2a6a3a878702c14a24e0. The PSEP didn't reach the final version yet, so this commit can't be released. --- libshiboken/basewrapper.cpp | 96 ++------------------------------------------- 1 file changed, 3 insertions(+), 93 deletions(-) (limited to 'libshiboken/basewrapper.cpp') diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index 8ccf89a6b..5431c4149 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -29,8 +29,6 @@ #include #include #include -#include -#include #include #include "threadstatesaver.h" @@ -214,7 +212,7 @@ void SbkDeallocWrapper(PyObject* pyObj) if (sbkObj->d->hasOwnership && sbkObj->d->validCppObject) { SbkObjectType* sbkType = reinterpret_cast(pyObj->ob_type); if (sbkType->d->is_multicpp) { - Shiboken::DeallocVisitor visitor(sbkObj); + Shiboken::DtorCallerVisitor visitor(sbkObj); Shiboken::walkThroughClassHierarchy(pyObj->ob_type, &visitor); } else { void* cptr = sbkObj->d->cptr[0]; @@ -441,6 +439,8 @@ void DtorCallerVisitor::visit(SbkObjectType* node) void DtorCallerVisitor::done() { + Shiboken::Object::deallocData(m_pyObj, true); + std::list >::const_iterator it = m_ptrs.begin(); for (; it != m_ptrs.end(); ++it) { Shiboken::ThreadStateSaver threadSaver; @@ -449,12 +449,6 @@ void DtorCallerVisitor::done() } } -void DeallocVisitor::done() -{ - Shiboken::Object::deallocData(m_pyObj, true); - DtorCallerVisitor::done(); -} - namespace Module { void init(); } void init() @@ -789,27 +783,6 @@ bool hasCppWrapper(SbkObject* pyObj) return pyObj->d->containsCppWrapper; } -bool wasCreatedByPython(SbkObject* pyObj) -{ - return pyObj->d->cppObjectCreated; -} - -void callCppDestructors(SbkObject* pyObj) -{ - SbkObjectType* sbkType = reinterpret_cast(pyObj->ob_type); - if (sbkType->d->is_multicpp) { - Shiboken::DtorCallerVisitor visitor(pyObj); - Shiboken::walkThroughClassHierarchy(pyObj->ob_type, &visitor); - } else { - Shiboken::ThreadStateSaver threadSaver; - threadSaver.save(); - sbkType->d->cpp_dtor(pyObj->d->cptr[0]); - } - delete[] pyObj->d->cptr; - pyObj->d->cptr = 0; - invalidate(pyObj); -} - bool hasOwnership(SbkObject* pyObj) { return pyObj->d->hasOwnership; @@ -931,16 +904,6 @@ void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType) return 0; } -std::vector cppPointers(SbkObject* pyObj) -{ - int n = getNumberOfCppBaseClasses(Py_TYPE(pyObj)); - std::vector ptrs(n); - for (int i = 0; i < n; ++i) - ptrs[i] = pyObj->d->cptr[i]; - return ptrs; -} - - bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr) { int idx = 0; @@ -1296,59 +1259,6 @@ void clearReferences(SbkObject* self) self->d->referredObjects = 0; } -std::string info(SbkObject* self) -{ - std::ostringstream s; - std::list bases = getCppBaseClasses(self->ob_type); - - s << "C++ address....... "; - std::list::const_iterator it = bases.begin(); - for (int i = 0; it != bases.end(); ++it, ++i) - s << ((PyTypeObject*)*it)->tp_name << "/" << self->d->cptr[i] << ' '; - s << "\n"; - - s << "hasOwnership...... " << bool(self->d->hasOwnership) << "\n" - "containsCppWrapper " << self->d->containsCppWrapper << "\n" - "validCppObject.... " << self->d->validCppObject << "\n" - "wasCreatedByPython " << self->d->cppObjectCreated << "\n"; - - - if (self->d->parentInfo && self->d->parentInfo->parent) { - s << "parent............ "; - Shiboken::AutoDecRef parent(PyObject_Str((PyObject*)self->d->parentInfo->parent)); - s << PyString_AS_STRING(parent.object()) << "\n"; - } - - if (self->d->parentInfo && self->d->parentInfo->children.size()) { - s << "children.......... "; - ChildrenList& children = self->d->parentInfo->children; - for (ChildrenList::const_iterator it = children.begin(); it != children.end(); ++it) { - Shiboken::AutoDecRef child(PyObject_Str((PyObject*)*it)); - s << PyString_AS_STRING(child.object()) << ' '; - } - s << '\n'; - } - - if (self->d->referredObjects && self->d->referredObjects->size()) { - Shiboken::RefCountMap& map = *self->d->referredObjects; - s << "referred objects.. "; - Shiboken::RefCountMap::const_iterator it = map.begin(); - for (; it != map.end(); ++it) { - if (it != map.begin()) - s << " "; - s << '"' << it->first << "\" => "; - std::list::const_iterator j = it->second.begin(); - for (; j != it->second.end(); ++j) { - Shiboken::AutoDecRef obj(PyObject_Str(*j)); - s << PyString_AS_STRING(obj.object()) << ' '; - } - s << ' '; - } - s << '\n'; - } - return s.str(); -} - } // namespace Object } // namespace Shiboken -- cgit v1.2.3