diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-02-05 16:28:01 -0300 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-02-05 16:41:41 -0200 |
commit | 658f6cbbb19ec9c2a2f8a0a0d703d8107ce9d722 (patch) | |
tree | 6b95a6ee086d0f8a83b445ece3318a2f08cb5826 /libshiboken | |
parent | c9e3bb47ee0eb929c6b4c43f9e3cd432ed449fc9 (diff) |
Shiboken::setParent also accepts list of children.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r-- | libshiboken/basewrapper.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index 2eaff65cb..d36e00493 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -57,8 +57,14 @@ void setParent(PyObject* parent, PyObject* child) if (!child || child == Py_None || child == parent) return; - bool parentIsNull = !parent || parent == Py_None; + //Recursive for sequence protocol + if (PySequence_Check(child)) { + for (int i = 0, max = PySequence_Size(child); i < max; ++i) + setParent(parent, PySequence_Fast_GET_ITEM(child, i)); + return; + } + bool parentIsNull = !parent || parent == Py_None; SbkBaseWrapper* parent_ = reinterpret_cast<SbkBaseWrapper*>(parent); SbkBaseWrapper* child_ = reinterpret_cast<SbkBaseWrapper*>(child); if (!child_->parentInfo) |