[issue6116] frame.f_locals keeps references to things for too long

Antoine Pitrou report at bugs.python.org
Thu May 5 17:50:10 CEST 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> Making a copy of f_locals values to return a dictionary that doesn't 
> hold references to the locals of the frame is not that simple

I think you misunderstood the bug report. The issue here is not that locals are referenced from the dict, it's that the dict is kept alive (since it is cached) longer that it should.

By the way, reading the discussion again, I think we could simply make dicts weak-referenceable. A dict is already quite big in memory and I don't think adding a pointer to the struct would make a significant difference.

----------
nosy: +gvanrossum, rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6116>
_______________________________________


More information about the Python-bugs-list mailing list