Skip to content

Commit 75d1b9c

Browse files
author
ziga.seilnacht
committed
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport. git-svn-id: http://svn.python.org/projects/python/trunk@54492 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 4b00ab1 commit 75d1b9c

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Diff for: Lib/sre.py

+3
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88

99
from re import *
1010
from re import __all__
11+
12+
# old pickles expect the _compile() reconstructor in this module
13+
from re import _compile

Diff for: Lib/test/test_re.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
sys.path = ['.'] + sys.path
33

4-
from test.test_support import verbose, run_unittest
4+
from test.test_support import verbose, run_unittest, guard_warnings_filter
55
import re
66
from re import Scanner
77
import sys, os, traceback
@@ -414,6 +414,12 @@ def test_pickling(self):
414414
self.pickle_test(pickle)
415415
import cPickle
416416
self.pickle_test(cPickle)
417+
# old pickles expect the _compile() reconstructor in sre module
418+
import warnings
419+
with guard_warnings_filter():
420+
warnings.filterwarnings("ignore", "The sre module is deprecated",
421+
DeprecationWarning)
422+
from sre import _compile
417423

418424
def pickle_test(self, pickle):
419425
oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)')

Diff for: Misc/NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ Core and builtins
192192
Library
193193
-------
194194

195+
- Bug #1675967: re patterns pickled with Python 2.4 and earlier can
196+
now be unpickled with Python 2.5 and newer.
197+
195198
- Patch #1630118: add a SpooledTemporaryFile class to tempfile.py.
196199

197200
- Patch #1273829: os.walk() now has a "followlinks" parameter. If set to

0 commit comments

Comments
 (0)