Issue 7128: cPickle looking for non-existent package copyreg (original) (raw)

Created on 2009-10-14 16:12 by joequant, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cpickle_restricted.patch amaury.forgeotdarc,2009-10-15 21:29
remove_copyreg_str.diff alexandre.vassalotti,2009-11-21 18:02
Messages (8)
msg94004 - (view) Author: Joseph C Wang (joequant) Date: 2009-10-14 16:12
When running cPickle in restricted mode, the module tries to import copyreg which does not appear to exist anywhere. The problem is in cPickle.c 2980 if (PyEval_GetRestricted()) { 2981 /* Restricted execution, get private tables */ 2982 PyObject *m = PyImport_Import(copyreg_str); 2983 2984 if (m == NULL) 2985 goto err; 2986 self->dispatch_table = PyObject_GetAttr(m, dispatch_table_str); 2987 Py_DECREF(m); 2988 if (self->dispatch_table == NULL) 2989 goto err; 2990 } 2991 else { 2992 self->dispatch_table = dispatch_table; 2993 Py_INCREF(dispatch_table); 2994 } copyreg_str should probably be copy_reg_str
msg94110 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-10-15 21:29
Here is a test+patch. This does not apply to py3k: restricted mode does not exist there.
msg94208 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-10-18 08:13
Probably the whole of r63042 should be undone.
msg95577 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-11-21 05:53
But, that change was undone already, no? In fact, it is you, Georg, that reverted my mess in r63493. ;-)
msg95578 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-11-21 13:25
Now I'm confused. So the only thing left to do is the patch attached here?
msg95587 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-11-21 18:02
Yes. But, I would remove the ugly copy_reg_str variable from cPickle as the patch.
msg95655 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-11-23 20:24
Patch looks ok to me, do you want to apply it?
msg95693 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-11-24 18:07
Thanks you! Committed in r76499 and backported to 2.6 in r76500.
History
Date User Action Args
2022-04-11 14:56:53 admin set github: 51377
2009-11-24 18:07:41 alexandre.vassalotti set status: open -> closedresolution: acceptedmessages: + stage: needs patch -> resolved
2009-11-23 20:24:22 georg.brandl set messages: +
2009-11-21 18:02:53 alexandre.vassalotti set files: + remove_copyreg_str.diffmessages: +
2009-11-21 13:25:35 georg.brandl set messages: +
2009-11-21 05:53:02 alexandre.vassalotti set nosy: + alexandre.vassalottimessages: +
2009-10-18 08:13:14 georg.brandl set nosy: + georg.brandlmessages: +
2009-10-15 21:29:49 amaury.forgeotdarc set files: + cpickle_restricted.patchnosy: + amaury.forgeotdarcmessages: + keywords: + patch
2009-10-14 22:31:59 pitrou set priority: highkeywords: + easystage: needs patchversions: + Python 2.7
2009-10-14 16:12:33 joequant create