]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1675967: re patterns pickled with older Python versions can
authorŽiga Seilnacht <ziga.seilnacht@gmail.com>
Wed, 21 Mar 2007 20:07:56 +0000 (20:07 +0000)
committerŽiga Seilnacht <ziga.seilnacht@gmail.com>
Wed, 21 Mar 2007 20:07:56 +0000 (20:07 +0000)
now be unpickled. Will backport.

Lib/sre.py
Lib/test/test_re.py
Misc/NEWS

index 390094aaa68be78c672ffe2275875d24fa752a57..c04576bafa58871e84333c0da2a074614c01e97b 100644 (file)
@@ -8,3 +8,6 @@ warnings.warn("The sre module is deprecated, please import re.",
 
 from re import *
 from re import __all__
+
+# old pickles expect the _compile() reconstructor in this module
+from re import _compile
index 14a0acfc6bd1d6dbc2e05ac8dc7bf42702b62078..bb568612fa795e0b40f7c306d6da12fe7c162545 100644 (file)
@@ -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 @@ class ReTests(unittest.TestCase):
         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)+?(.)')
index a2ec9a7e741b151ac2410804acb592df441cb493..0d9ec6c238c32e65bfc3bf3d2462d19243ae3a03 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -192,6 +192,9 @@ Core and builtins
 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