File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ class object : public handle {
254
254
255
255
.. code-block:: cpp
256
256
257
- PyObject *result = PySequence_GetItem (obj, index);
257
+ PyObject *p = PyList_GetItem (obj, index);
258
258
py::object o = reinterpret_borrow<py::object>(p);
259
259
// or
260
260
py::tuple t = reinterpret_borrow<py::tuple>(p); // <-- `p` must be already be a `tuple`
@@ -453,7 +453,7 @@ struct sequence_item {
453
453
static object get (handle obj, size_t index) {
454
454
PyObject *result = PySequence_GetItem (obj.ptr (), static_cast <ssize_t >(index));
455
455
if (!result) { throw error_already_set (); }
456
- return reinterpret_borrow <object>(result);
456
+ return reinterpret_steal <object>(result);
457
457
}
458
458
459
459
static void set (handle obj, size_t index, handle val) {
You can’t perform that action at this time.
0 commit comments