summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2005-09-15 02:34:56 (GMT)
committerBrett Cannon <bcannon@gmail.com>2005-09-15 02:34:56 (GMT)
commita783d06f8cb4077dd34567fde418bf6c23073912 (patch)
tree5b8fd68bf9715fdb363227fce18d6bf77e71f19d /Lib/test
parentfb1ef85b0bbb6336e03489af7adaff494bd2b2bb (diff)
downloadcpython-a783d06f8cb4077dd34567fde418bf6c23073912.zip
cpython-a783d06f8cb4077dd34567fde418bf6c23073912.tar.gz
cpython-a783d06f8cb4077dd34567fde418bf6c23073912.tar.bz2
Clear out the regex cache when the TimeRE cache is invalidated by a locale
change. Fixes bug #1290505.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_strptime.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 785497a..f9763aa 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -462,10 +462,12 @@ class CacheTests(unittest.TestCase):
# Make sure cache is recreated when current locale does not match what
# cached object was created with.
_strptime.strptime("10", "%d")
+ _strptime.strptime("2005", "%Y")
_strptime._TimeRE_cache.locale_time.lang = "Ni"
original_time_re = id(_strptime._TimeRE_cache)
_strptime.strptime("10", "%d")
self.failIfEqual(original_time_re, id(_strptime._TimeRE_cache))
+ self.failUnlessEqual(len(_strptime._regex_cache), 1)
def test_regex_cleanup(self):
# Make sure cached regexes are discarded when cache becomes "full".