homepage

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 ncoghlan
Recipients Robin.Schreiber, daniel.urban, loewis, ncoghlan, pitrou
Date 2012年06月23日.08:42:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340440957.09.0.552325699632.issue15142@psf.upfronthosting.co.za>
In-reply-to
Content
You're right, I was confusing what happens automatically for classes defined in Python (i.e. the full treatment in type_new) vs those defined statically (i.e. just the parts in PyType_Ready).
Given that PyType_FromSpec doesn't currently support inheritance, providing a default tp_dealloc before the inherit_slots() call in PyType_Ready would work OK in the near term.
However, once inheritance support is added by #15146 then it would be wrong - the default slot entry would override an inherited one.
So, I think this adjustment actually needs to be handled in PyType_Ready, at some point after the inherit_slots() call.
Something like:
 /* Sanity check for tp_dealloc. */
 if ((type->tp_flags & Py_TPFLAGS_HEAPTYPE) &&
 (type->tp_dealloc == type_dealloc)) {
 /* Type has been declared as a heap type, but has inherited the
 default allocator. This can happen when using the limited API
 to dynamically create types.
 */
 type->tp_dealloc = subtype_dealloc;
 }
History
Date User Action Args
2012年06月23日 08:42:37ncoghlansetrecipients: + ncoghlan, loewis, pitrou, daniel.urban, Robin.Schreiber
2012年06月23日 08:42:37ncoghlansetmessageid: <1340440957.09.0.552325699632.issue15142@psf.upfronthosting.co.za>
2012年06月23日 08:42:36ncoghlanlinkissue15142 messages
2012年06月23日 08:42:34ncoghlancreate

AltStyle によって変換されたページ (->オリジナル) /