Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
--- /dev/null
+Fix an issue in the :mod:`!_pickle` extension module in which importing
+:mod:`multiprocessing` could change how pickle identifies which module an
+object belongs to, potentially breaking the unpickling of those objects.
_PyUnicode_EqualToASCIIString(module_name, "__main__")) {
return -1;
}
+ if (PyUnicode_Check(module_name) &&
+ _PyUnicode_EqualToASCIIString(module_name, "__mp_main__")) {
+ return -1;
+ }
PyObject *candidate = getattribute(module, dotted_path, 0);
if (candidate == NULL) {