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 facundobatista
Recipients exarkun, facundobatista, pitrou, vstinner
Date 2011-05-05.14:45:58
SpamBayes Score 2.6361818e-07
Marked as misclassified No
Message-id <1304606760.56.0.825883382704.issue6116@psf.upfronthosting.co.za>
In-reply-to
Content
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 (for me, at least):

- shallow copy: we'll return always a new dict, with the values being a copy of locals; this is simpler, but what about other objects that are referenced in in those values? For example, in locals exists a list A which holds a reference to object B; the new dict we return will have copy of A, but this copy will still reference B.

- deep copy: we'll return a new dict with a deep copy of all values; this is safer, but what about memory? In any case, how we could do a deep copy here? calling Python's code copy.deepcopy()?

I want to add a fourth option to JP's initial ones:

- have other attribute, something like f_locals_weak that is a list of tuples [(name, value), ...], being the values a weak reference to the real locals.

What do you think?

Regards,
History
Date User Action Args
2011-05-05 14:46:00facundobatistasetrecipients: + facundobatista, exarkun, pitrou, vstinner
2011-05-05 14:46:00facundobatistasetmessageid: <1304606760.56.0.825883382704.issue6116@psf.upfronthosting.co.za>
2011-05-05 14:45:58facundobatistalinkissue6116 messages
2011-05-05 14:45:58facundobatistacreate