[Python-checkins] python/dist/src/Lib _strptime.py, 1.38.2.2, 1.38.2.3

bcannon@users.sourceforge.net bcannon at users.sourceforge.net
Thu Sep 15 04:42:08 CEST 2005


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

Modified Files:
      Tag: release24-maint
	_strptime.py 
Log Message:
Clear the regex cache when the locale changes.

Backport of fix for bug #1290505.


Index: _strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v
retrieving revision 1.38.2.2
retrieving revision 1.38.2.3
diff -u -d -r1.38.2.2 -r1.38.2.3
--- _strptime.py	29 Aug 2005 18:26:48 -0000	1.38.2.2
+++ _strptime.py	15 Sep 2005 02:42:05 -0000	1.38.2.3
@@ -272,13 +272,14 @@
 
 def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
     """Return a time struct based on the input string and the format string."""
-    global _TimeRE_cache
+    global _TimeRE_cache, _regex_cache
     _cache_lock.acquire()
     try:
         time_re = _TimeRE_cache
         locale_time = time_re.locale_time
         if _getlang() != locale_time.lang:
             _TimeRE_cache = TimeRE()
+            _regex_cache = {}
         if len(_regex_cache) > _CACHE_MAX_SIZE:
             _regex_cache.clear()
         format_regex = _regex_cache.get(format)



More information about the Python-checkins mailing list