Nick Coghlan <ncogh...@gmail.com> added the comment:

Some additional thoughts for anyone else that comes across this issue.

Consider the case of a weakref proxy (the only proxy type in the stdlib): for 
that, you never want to serialise the proxy, you want to serialise the original 
object.

To correctly serialise a proxy object, you have to somehow ensure:
- the proxy gets serialised
- the target gets serialised
- the two get hooked up again at the far end

Now consider what happens if you have *two* proxies both pointing at the same 
target: how do you ensure that, when deserialised, both proxies still share a 
target?

In the general case, you can't - so pickle doesn't even try. Instead, 
serialising a proxy serialises the original object - if you want to do 
something else, you need to decide for yourself how to recreate the 
cross-references correctly on deserialisation.

----------
nosy: +ncoghlan

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14577>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to