I am using a Python C Api to fill the list containing the PyObject*
elements and transfer it to the function in Python. Everything went very smoothly but there is one issue - transfered list in Python is containing odd <NULL>
entries. List is containing "wanted" objects as well so it looks like it's almost-working.
This is the list preview:
[<NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <NULL>, <dbg.TBack object at 0x19675870>, <interface.Grid object at 0x196758B0>, <interface.Grid object at 0x196758F0>, <interface.slp object at 0x196757D0>]
Code I am using for filling the list in Python C API.
PyObject* list = PyList_New(objectsList.size());
PyObject* handle;
for (auto child : objectsList) {
if (!child) {
continue;
}
handle = child->GetHandle(); // handle = PyObject*
if (!handle) {
continue;
}
PyList_Append(list, handle);
}
return list; // push
I have tried adding if(!handle)
checks but it doesn't seem to have any result in practise.