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 llllllllll
Recipients barry, eric.smith, eric.snow, llllllllll, rhettinger, serhiy.storchaka
Date 2015-04-29.17:18:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I don't think that we need to worry about reusing the single argument tuple in a recursive situation because we never need the value after we start the call. We also just write our new value and then clean up with a NULL to make sure that we don't blow up when we dealloc the tuple. For example:

>>> class C(object):
...     @property
...     def f(self):
...         return D().f
>>> class D(object):
...     @property
...     def f(self):
...         return 1
>>> C().f

This works with recursive properties.
I also think that is is getting cleaned up on shutdown, if I put a pointer to garbage in the tuple, the interpreter blows up on shutdown; this makes me think that tuple_dealloc is being called somewhere. About putting the tuple on the property instance, that would nice for memory management; however, that increases the memory overhead of each property. This also means that we would only get the faster lookup after the property has been accessed once; this is fine but the current implementation makes it so that all properties are faster after any of them are looked up once. I could be wrong about the cleanup though.

I am also updating the title and headers because this issue is no longer about namedtuple.
Date User Action Args
2015-04-29 17:18:54llllllllllsetrecipients: + llllllllll, barry, rhettinger, eric.smith, eric.snow, serhiy.storchaka
2015-04-29 17:18:54llllllllllsetmessageid: <>
2015-04-29 17:18:54lllllllllllinkissue23910 messages
2015-04-29 17:18:53llllllllllcreate