Message158259
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. |
|
Date |
User |
Action |
Args |
2012-04-14 11:48:59 | ncoghlan | set | recipients:
+ ncoghlan, pitrou, alexandre.vassalotti, michael.foord |
2012-04-14 11:48:59 | ncoghlan | set | messageid: <1334404139.5.0.0525689308052.issue14577@psf.upfronthosting.co.za> |
2012-04-14 11:48:58 | ncoghlan | link | issue14577 messages |
2012-04-14 11:48:58 | ncoghlan | create | |
|