From: Brett Cannon Date: Wed, 6 Oct 2004 02:16:45 +0000 (+0000) Subject: Escape locale data for regex metacharacters. X-Git-Tag: v2.3.5c1~104 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d980c92089e5018913f3570039073f100d70d09b;p=thirdparty%2FPython%2Fcpython.git Escape locale data for regex metacharacters. Closes bug #1039270. --- diff --git a/Lib/_strptime.py b/Lib/_strptime.py index 1d05869f0d72..cc578305ad98 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -18,6 +18,7 @@ import locale 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 @@ class TimeRE(dict): 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 diff --git a/Misc/NEWS b/Misc/NEWS index 6c748f953992..15b6b7f7b129 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -53,6 +53,8 @@ Extension modules Library ------- +- Bug #1039270: Locale data is now escaped for regex metacharacters. + - Bug #807871: Fix tkMessageBox.askyesno result. - Patch #1014992: In tarfile.readline, never return more than a line.