Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Commit e5c21d6

Browse files
committed
use space.getitem, fixes pybind11 (pybind/pybind11#2146)
1 parent e8ddcf1 commit e5c21d6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pypy/module/cpyext/sequence.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,9 @@ def PySequence_ITEM(space, w_obj, i):
164164
incref(space, py_res)
165165
keepalive_until_here(w_obj)
166166
return py_res
167-
168-
as_sequence = py_obj.c_ob_type.c_tp_as_sequence
169-
if not as_sequence or not as_sequence.c_sq_item:
170-
raise oefmt(space.w_TypeError,
171-
"'%T' object does not support indexing", w_obj)
172-
ret = generic_cpy_call(space, as_sequence.c_sq_item, w_obj, i)
173-
return make_ref(space, ret)
167+
168+
w_ret = space.getitem(w_obj, space.newint(i))
169+
return make_ref(space, w_ret)
174170

175171
@cpython_api([PyObject, Py_ssize_t], PyObject, result_is_ll=True)
176172
def PySequence_GetItem(space, w_obj, i):

0 commit comments

Comments
 (0)