Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
#86572 describes a bug where importingmultiprocessing causespickle to determine the wrong module for objects without__module__.#23403 fixed the bug, but only for the pure Python implementation ofpickle. The C extension module is still broken.
Consider a filefoo.py containing:
deff():passdelf.__module__
Then, in an interactive session:
>>>importmultiprocessing>>>fromfooimportf>>>importpickle>>>importpickletools>>>pickletools.dis(pickle.dumps(f))0: \x80PROTO42: \x95FRAME2111: \x8cSHORT_BINUNICODE'__mp_main__'24: \x94MEMOIZE (as0)25: \x8cSHORT_BINUNICODE'f'28: \x94MEMOIZE (as1)29: \x93STACK_GLOBAL30: \x94MEMOIZE (as2)31: .STOPhighestprotocolamongopcodes=4>>>pickletools.dis(pickle._dumps(f))0: \x80PROTO42: \x95FRAME1311: \x8cSHORT_BINUNICODE'foo'16: \x94MEMOIZE (as0)17: \x8cSHORT_BINUNICODE'f'20: \x94MEMOIZE (as1)21: \x93STACK_GLOBAL22: \x94MEMOIZE (as2)23: .STOPhighestprotocolamongopcodes=4
pickle.dumps tries to importf from__mp_main__.pickle._dumps correctly determines thatf comes from thefoo module.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux