[Python-checkins] python/dist/src/Lib/test test_strptime.py, 1.29, 1.30

bcannon@users.sourceforge.net bcannon at users.sourceforge.net
Thu Sep 15 04:34:59 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4715/Lib/test

Modified Files:
	test_strptime.py 
Log Message:
Clear out the regex cache when the TimeRE cache is invalidated by a locale
change.

Fixes bug #1290505.


Index: test_strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- test_strptime.py	28 Oct 2004 04:49:21 -0000	1.29
+++ test_strptime.py	15 Sep 2005 02:34:56 -0000	1.30
@@ -462,10 +462,12 @@
         # 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".



More information about the Python-checkins mailing list