summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorŽiga Seilnacht <ziga.seilnacht@gmail.com>2007-03-21 20:37:39 (GMT)
committerŽiga Seilnacht <ziga.seilnacht@gmail.com>2007-03-21 20:37:39 (GMT)
commite5df857cc3eb646d6d921eab14398fc8f47b8be9 (patch)
treef7be216d09f48dfa04e280b0ebe44e80fb0c66b9
parent7ed0a6583188e3fdfd8912f05a5219771c419cf1 (diff)
downloadcpython-e5df857cc3eb646d6d921eab14398fc8f47b8be9.zip
cpython-e5df857cc3eb646d6d921eab14398fc8f47b8be9.tar.gz
cpython-e5df857cc3eb646d6d921eab14398fc8f47b8be9.tar.bz2
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. (backport form rev. 54492)
-rw-r--r--Lib/sre.py3
-rw-r--r--Lib/test/test_re.py9
-rw-r--r--Misc/NEWS3
3 files changed, 15 insertions, 0 deletions
diff --git a/Lib/sre.py b/Lib/sre.py
index 390094a..c04576b 100644
--- a/Lib/sre.py
+++ b/Lib/sre.py
@@ -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
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 14a0acf..a885180 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -414,6 +414,15 @@ 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
+ 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)+?(.)')
diff --git a/Misc/NEWS b/Misc/NEWS
index 19b8f1c..e526ac3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -217,6 +217,9 @@ Extension Modules
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.