Index: Lib/_strptime.py =================================================================== --- Lib/_strptime.py (revision 69496) +++ Lib/_strptime.py (working copy) @@ -14,7 +14,7 @@ import locale import calendar from re import compile as re_compile -from re import IGNORECASE, ASCII +from re import IGNORECASE from re import escape as re_escape from datetime import date as datetime_date try: @@ -262,7 +262,7 @@ def compile(self, format): """Return a compiled re object for the format string.""" - return re_compile(self.pattern(format), IGNORECASE | ASCII) + return re_compile(self.pattern(format), IGNORECASE) _cache_lock = _thread_allocate_lock() # DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock Index: Lib/test/test_strptime.py =================================================================== --- Lib/test/test_strptime.py (revision 69496) +++ Lib/test/test_strptime.py (working copy) @@ -385,6 +385,16 @@ need_escaping = ".^$*+?{}\[]|)(" self.failUnless(_strptime._strptime_time(need_escaping, need_escaping)) + def test_unicode(self): + # Issue 5240 + strf_output = time.strftime("%a\u0020%b", self.time_tuple) + self.failUnless(_strptime._strptime_time(strf_output, "%a\u0020%b")) + strf_output = time.strftime("%a\u3000%b", self.time_tuple) + self.failUnless(_strptime._strptime_time(strf_output, "%a\u3000%b")) + # Issue 5239 + strp_output = _strptime._strptime_time("\uff12\uff10\uff10\uff19", "%Y") + self.assertEquals(strp_output.tm_year, 2009) + class Strptime12AMPMTests(unittest.TestCase): """Test a _strptime regression in '%I %p' at 12 noon (12 PM)"""