I am moving CPython calls to pybind. I had the following code:
PyObject* my_list = ...;
PyList_SetSlice(my_list , i, i+1, NULL);
Which was used to remove an item. Now, switching to pybind11, I have
py::list my_list = ...;
And I would like to write something like
my_list.pop(i);
But I didn't find anything to do that. What should I do? Is the following correct:
PyList_SetSlice(my_list.ptr() , i, i+1, NULL);
Or am I leaking the object my_list[i]
?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…