1. Armin Rigo
  2. cpython-withatomic

Commits

Ziga Seilnacht  committed 408dfc7

Bug #1675967: re patterns pickled with older Python versions can
now be unpickled.
(backport form rev. 54492)

  • Participants
  • Parent commits f889f65
  • Branches 2.5

Comments (0)

Files changed (3)

File Lib/sre.py

View file
  • Ignore whitespace
 
 from re import *
 from re import __all__
+
+# old pickles expect the _compile() reconstructor in this module
+from re import _compile

File Lib/test/test_re.py

View file
  • Ignore whitespace
         self.pickle_test(pickle)
         import cPickle
         self.pickle_test(cPickle)
+        # old pickles expect the _compile() reconstructor in sre module
+        import warnings
+        original_filters = warnings.filters[:]
+        try:
+            warnings.filterwarnings("ignore", "The sre module is deprecated",
+                                    DeprecationWarning)
+            from sre import _compile
+        finally:
+            warnings.filters = original_filters
 
     def pickle_test(self, pickle):
         oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)')

File Misc/NEWS

View file
  • Ignore whitespace
 Library
 -------
 
+- Bug #1675967: re patterns pickled with Python 2.4 and earlier can
+  now be unpickled with Python 2.5.
+
 - Bug #1684254: webbrowser now uses shlex to split any command lines
   given to get(). It also detects when you use '&' as the last argument
   and creates a BackgroundBrowser then.