Bruce Christensen wrote:
>> If obj has no __module__ attribute (or if it is None), pickle
>> (didn't check cPickle) also does
>>
>> for n, module in sys.module.items():
>> if "module-ignored": continue
>> if getattr(module, result, None) is obj:
>> break # use n as module name
>
> What i
Martin v. Löwis" wrote:
> If obj has no __module__ attribute (or if it is None), pickle
> (didn't check cPickle) also does
>
> for n, module in sys.module.items():
> if "module-ignored": continue
> if getattr(module, result, None) is obj:
> break # use n as module name
>
> If obj does
Bruce Christensen wrote:
> Is something like the following close?
Close, yes.
> if type(result) == tuple:
> ... (do appropriate things here)
> elif isinstance(result, basestring):
> name = result
> module = ""
> try:
> module = obj.__module__
>
I'm still plugging away on IronPython's cPickle, and I've stumbled
across another ambiguity in the pickle docs. From
http://docs.python.org/lib/node69.html:
"If a string is returned, it names a global variable whose contents are
pickled as normal. The string returned by __reduce__ should be the
ob