Message145013
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). |
|
Date |
User |
Action |
Args |
2011-10-06 14:10:26 | awilkins | set | recipients:
+ awilkins |
2011-10-06 14:10:26 | awilkins | set | messageid: <1317910226.56.0.365091018544.issue13115@psf.upfronthosting.co.za> |
2011-10-06 14:10:25 | awilkins | link | issue13115 messages |
2011-10-06 14:10:25 | awilkins | create | |
|