mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
This commit is contained in:
parent
3ff9e55890
commit
7492e4260e
3 changed files with 13 additions and 1 deletions
|
@ -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)+?(.)')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue