New submission from Robin Schreiber: To create a HeapType from Structseq description, there is the helpful, yet undocumented PyStructSequence_NewType Method, which can do just that. Until now, this method solely allocates some generic TypeObject on which it then performs PyStructSequence_InitType().
I have found that this is far from enough, as for one the flags of the type are not set appropriately and neither ht_name nor ht_qualname are set (which is as far as I know required of a proper Heaptype). I have now added this missing initialization of the fields to PyStructSequence_NewType(). I have also changed the previous definition of PyStructSequence_InitType, by extracting a new Method _PyStructSequence_InitTypeWithFlags. This initializes the given type with the flags variable passed to the function. This method extraction is needed, as we can not alter the semantics of InitType itself, yet need some way to initialize a SequenceType with Heaptype-flags, without having too much duplicate code. ---------- components: Interpreter Core files: structseq_newtype_fix.patch keywords: patch messages: 168595 nosy: Robin.Schreiber, loewis priority: normal severity: normal status: open title: PyStructSequence_NewType enhancement type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file26901/structseq_newtype_fix.patch _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue15729> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
