We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e74923 commit b79f1afCopy full SHA for b79f1af
graalpython/com.oracle.graal.python.test/src/tests/cpyext/test_tp_slots.py
@@ -379,3 +379,16 @@ def test_type_not_ready():
379
""", "NotReadyType")
380
not_ready = module.create_not_ready()
381
assert not_ready.foo == 'foo'
382
+
383
384
+def test_sq_len_and_item():
385
+ MySqLenItem = CPyExtType("MySqLenItem",
386
+ '''
387
+ Py_ssize_t my_sq_len(PyObject* a) { return 10; }
388
+ PyObject* my_sq_item(PyObject* self, Py_ssize_t index) { return PyLong_FromSsize_t(index); }
389
+ ''',
390
+ sq_length="&my_sq_len",
391
+ sq_item="my_sq_item")
392
+ x = MySqLenItem()
393
+ assert x[5] == 5
394
+ assert x[-1] == 9
0 commit comments