New submission from Andrew Wilkins <axw...@gmail.com>: I've written an extension using Py_LIMITED_API, and I've created a type using PyType_FromSpec with the slot "Py_sq_length" defined. The slot is not being picked up, i.e. len(MyType()) fails. I can see that tp_as_sequence has not been set, which explains why. All is well if I set it manually (without Py_LIMITED_API defined), like so: MyType->tp_as_sequence = &((PyHeapTypeObject*)MyType)->as_sequence;
As far as I can see (docs are lacking), there's no way of setting tp_as_number, tp_as_sequence or tp_as_mapping in types created with PyType_FromSpec. I would expect the presence of any Py_sq_* slots to set tp_as_sequence (likewise for number and mapping). ---------- components: Interpreter Core messages: 145013 nosy: awilkins priority: normal severity: normal status: open title: tp_as_{number,sequence,mapping} can't be set using PyType_FromSpec versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13115> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com