This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author awilkins
Recipients awilkins
Date 2011-10-06.14:10:25
SpamBayes Score 2.018235e-06
Marked as misclassified No
Message-id <1317910226.56.0.365091018544.issue13115@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2011-10-06 14:10:26awilkinssetrecipients: + awilkins
2011-10-06 14:10:26awilkinssetmessageid: <1317910226.56.0.365091018544.issue13115@psf.upfronthosting.co.za>
2011-10-06 14:10:25awilkinslinkissue13115 messages
2011-10-06 14:10:25awilkinscreate