Message73165
| Author |
tim.peters |
| Recipients |
alexandre.vassalotti, amaury.forgeotdarc, barry, benjamin.peterson, nnorwitz, pitrou, tim.peters |
| Date |
2008年09月13日.04:14:46 |
| SpamBayes Score |
5.759948e-12 |
| Marked as misclassified |
No |
| Message-id |
<1221279287.54.0.322756532803.issue3657@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
BTW, note that the Title of this issue is misleading:
pickle.whichmodule() uses object identity ("is":
if ... getattr(module, funcname, None) is func:
) to determine whether the given function object is supplied by a
module, so it's /not/ the case that a "wrong" function can be pickled.
The worst that can happen is that the correct function is pickled but
obtained from a possibly surprising module. For example, random.random
can't be confused with any other function named "random".
I expect this is why nobody has ever complained about it: unless you're
looking at the strings embedded in the pickle GLOBAL opcode, it's
unlikely to have a visible consequence.
It would still be nice if pickle could identify "the most natural"
module for a given function, but hard to make a case that doing so would
be much more than /just/ "nice". |
|