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 Mark.Shannon
Recipients Mark.Shannon, Trundle, amaury.forgeotdarc, benjamin.peterson, davide.rizzo, ezio.melotti, orsenthil, pitrou, python-dev, vstinner
Date 2011-12-15.12:21:06
SpamBayes Score 6.75004e-09
Marked as misclassified No
Message-id <4EE9E632.7010805@hotpy.org>
In-reply-to <1323949406.3345.0.camel@localhost.localdomain>
Content
Antoine Pitrou wrote:
> Antoine Pitrou <pitrou@free.fr> added the comment:
> 
>> I have added a call to PyType_Modified in type_clear (as well as
>> type_set_name and type_set_qualname, which also modify the type).
> 
> Can __name__ and __qualname__ be looked up through the method cache?

__name__ and __qualname__ are not looked up through the method cache,
but their descriptors could be.
Changing the descriptors would be caught elsewhere,
so there is no need to to add any PyType_Modified to
type_set_name and type_set_qualname.

However, calls to PyType_Modified will never cause any errors,
and if only used for genuine type modifications, will cause no 
discernible performance degradation.

Since PyType_Modified is generally called whenever a type is modified, 
it is likely to act as a guardian for any future optimisations that 
require classes to be unchanged.

Thus, given these two reasons, it seems wise to call PyType_Modified 
anywhere the type is modified, however minor that modification appears 
to be.
History
Date User Action Args
2011-12-15 12:21:07Mark.Shannonsetrecipients: + Mark.Shannon, amaury.forgeotdarc, orsenthil, pitrou, vstinner, benjamin.peterson, ezio.melotti, Trundle, davide.rizzo, python-dev
2011-12-15 12:21:07Mark.Shannonlinkissue12149 messages
2011-12-15 12:21:06Mark.Shannoncreate