[Python-checkins] python/dist/src/Lib _strptime.py, 1.23.4.4, 1.23.4.5

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Wed Oct 6 04:16:47 CEST 2004


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

Modified Files:
      Tag: release23-maint
	_strptime.py 
Log Message:
Escape locale data for regex metacharacters.

Closes bug #1039270.


Index: _strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v
retrieving revision 1.23.4.4
retrieving revision 1.23.4.5
diff -u -d -r1.23.4.4 -r1.23.4.5
--- _strptime.py	29 Aug 2003 02:34:22 -0000	1.23.4.4
+++ _strptime.py	6 Oct 2004 02:16:45 -0000	1.23.4.5
@@ -18,6 +18,7 @@
 import calendar
 from re import compile as re_compile
 from re import IGNORECASE
+from re import escape as re_escape
 from datetime import date as datetime_date
 
 __author__ = "Brett Cannon"
@@ -367,7 +368,7 @@
         else:
             return ''
         to_convert.sort(sorter)
-        regex = '|'.join(to_convert)
+        regex = '|'.join([re_escape(stuff) for stuff in to_convert])
         regex = '(?P<%s>%s' % (directive, regex)
         return '%s)' % regex
 



More information about the Python-checkins mailing list