
python-checkins at python
Nov 24, 2009, 10:20 AM
Post #1 of 1
(133 views)
Permalink
|
|
r76500 - in python/branches/release26-maint: Lib/test/pickletester.py Modules/cPickle.c
|
|
Author: alexandre.vassalotti Date: Tue Nov 24 19:06:51 2009 New Revision: 76500 Log: Merged revisions 76499 via svnmerge from svn+ssh://pythondev [at] svn/python/trunk ........ r76499 | alexandre.vassalotti | 2009-11-24 12:53:23 -0500 (Tue, 24 Nov 2009) | 9 lines Issue 7128: Removed reference to the non-existent copyreg module. The reference to copyreg was a unnoticed leftover from the compatibility support for the grand renaming of the standard library in Python 3. The compatibility support was reverted in r63493, but not completely as this patch shows. Based on a patch by Amaury Forgeot d'Arc. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/pickletester.py python/branches/release26-maint/Modules/cPickle.c Modified: python/branches/release26-maint/Lib/test/pickletester.py ============================================================================== --- python/branches/release26-maint/Lib/test/pickletester.py (original) +++ python/branches/release26-maint/Lib/test/pickletester.py Tue Nov 24 19:06:51 2009 @@ -1020,6 +1020,16 @@ s = StringIO.StringIO("X''.") self.assertRaises(EOFError, self.module.load, s) + def test_restricted(self): + # issue7128: cPickle failed in restricted mode + builtins = {self.module.__name__: self.module, + '__import__': __import__} + d = {} + teststr = "def f(): {0}.dumps(0)".format(self.module.__name__) + exec teststr in {'__builtins__': builtins}, d + d['f']() + + class AbstractPersistentPicklerTests(unittest.TestCase): # This class defines persistent_id() and persistent_load() Modified: python/branches/release26-maint/Modules/cPickle.c ============================================================================== --- python/branches/release26-maint/Modules/cPickle.c (original) +++ python/branches/release26-maint/Modules/cPickle.c Tue Nov 24 19:06:51 2009 @@ -132,7 +132,7 @@ *__reduce_ex___str, *write_str, *append_str, *read_str, *readline_str, *__main___str, - *copyreg_str, *dispatch_table_str; + *dispatch_table_str; /************************************************************************* Internal Data type for pickle data. */ @@ -2985,7 +2985,7 @@ if (PyEval_GetRestricted()) { /* Restricted execution, get private tables */ - PyObject *m = PyImport_Import(copyreg_str); + PyObject *m = PyImport_ImportModule("copy_reg"); if (m == NULL) goto err; @@ -5733,7 +5733,6 @@ INIT_STR(append); INIT_STR(read); INIT_STR(readline); - INIT_STR(copyreg); INIT_STR(dispatch_table); if (!( copyreg = PyImport_ImportModule("copy_reg"))) _______________________________________________ Python-checkins mailing list Python-checkins [at] python http://mail.python.org/mailman/listinfo/python-checkins
|