Commit 7492e426 authored by Žiga Seilnacht's avatar Žiga Seilnacht

Bug #1675967: re patterns pickled with older Python versions can

now be unpickled. Will backport.
parent 3ff9e558
...@@ -8,3 +8,6 @@ warnings.warn("The sre module is deprecated, please import re.", ...@@ -8,3 +8,6 @@ warnings.warn("The sre module is deprecated, please import re.",
from re import * from re import *
from re import __all__ from re import __all__
# old pickles expect the _compile() reconstructor in this module
from re import _compile
import sys import sys
sys.path = ['.'] + sys.path 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 import re
from re import Scanner from re import Scanner
import sys, os, traceback import sys, os, traceback
...@@ -414,6 +414,12 @@ class ReTests(unittest.TestCase): ...@@ -414,6 +414,12 @@ class ReTests(unittest.TestCase):
self.pickle_test(pickle) self.pickle_test(pickle)
import cPickle import cPickle
self.pickle_test(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): def pickle_test(self, pickle):
oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)') oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)')
......
...@@ -192,6 +192,9 @@ Core and builtins ...@@ -192,6 +192,9 @@ Core and builtins
Library 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 #1630118: add a SpooledTemporaryFile class to tempfile.py.
- Patch #1273829: os.walk() now has a "followlinks" parameter. If set to - Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment