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 Robin.Schreiber
Recipients Robin.Schreiber, loewis
Date 2012年08月19日.15:57:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345391866.4.0.54341725267.issue15727@psf.upfronthosting.co.za>
In-reply-to
Content
As with every type, that has been created and initialized, HeapTypes created form PyType_FromSpecWithBases() have to pass through PyType_Ready(). Here the function inherit_special might be called, which, among other things, does the following:
....
3892 if (base != &PyBaseObject_Type || 
3893 (type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
3894 if (type->tp_new == NULL)
3895 type->tp_new = base->tp_new;
3896 }
....
The code does not know of Heaptypes that have been created from extension-types by the PEP 384 refactorings. This includes extension-types that do not specify a tp_new method but instead have seperate factory methods, that are only used within the extension module. inherit_special() might consequently assign inappropriate new-methods to these type objects.
To circumvent this issue, I propose to enhance PyType_FromSpecWithBases in the following way: If no tp_new has been specified, we assign the newly defined PySpec_New() method to tp_new which simply denies the user to create an instance of this type. This also prohibits inherit_special to falsely inherit inappropriate new-methods.
History
Date User Action Args
2012年08月19日 15:57:46Robin.Schreibersetrecipients: + Robin.Schreiber, loewis
2012年08月19日 15:57:46Robin.Schreibersetmessageid: <1345391866.4.0.54341725267.issue15727@psf.upfronthosting.co.za>
2012年08月19日 15:57:45Robin.Schreiberlinkissue15727 messages
2012年08月19日 15:57:45Robin.Schreibercreate

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