[Python-checkins] r54492 - in python/trunk: Lib/sre.py Lib/test/test_re.py Misc/NEWS

ziga.seilnacht python-checkins at python.org
Wed Mar 21 21:08:00 CET 2007


Author: ziga.seilnacht
Date: Wed Mar 21 21:07:56 2007
New Revision: 54492

Modified:
   python/trunk/Lib/sre.py
   python/trunk/Lib/test/test_re.py
   python/trunk/Misc/NEWS
Log:
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.

Modified: python/trunk/Lib/sre.py
==============================================================================
--- python/trunk/Lib/sre.py	(original)
+++ python/trunk/Lib/sre.py	Wed Mar 21 21:07:56 2007
@@ -8,3 +8,6 @@
 
 from re import *
 from re import __all__
+
+# old pickles expect the _compile() reconstructor in this module
+from re import _compile

Modified: python/trunk/Lib/test/test_re.py
==============================================================================
--- python/trunk/Lib/test/test_re.py	(original)
+++ python/trunk/Lib/test/test_re.py	Wed Mar 21 21:07:56 2007
@@ -1,7 +1,7 @@
 import sys
 sys.path = ['.'] + sys.path
 
-from test.test_support import verbose, run_unittest
+from test.test_support import verbose, run_unittest, guard_warnings_filter
 import re
 from re import Scanner
 import sys, os, traceback
@@ -414,6 +414,12 @@
         self.pickle_test(pickle)
         import cPickle
         self.pickle_test(cPickle)
+        # old pickles expect the _compile() reconstructor in sre module
+        import warnings
+        with guard_warnings_filter():
+            warnings.filterwarnings("ignore", "The sre module is deprecated",
+                                    DeprecationWarning)
+            from sre import _compile
 
     def pickle_test(self, pickle):
         oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)')

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Mar 21 21:07:56 2007
@@ -192,6 +192,9 @@
 Library
 -------
 
+- Bug #1675967: re patterns pickled with Python 2.4 and earlier can
+  now be unpickled with Python 2.5 and newer.
+
 - Patch #1630118: add a SpooledTemporaryFile class to tempfile.py.
 
 - Patch #1273829: os.walk() now has a "followlinks" parameter. If set to


More information about the Python-checkins mailing list