changeset: 93298:1d87ac92b041 parent: 93295:bc4dd43b847b parent: 93297:0c016fa378db user: Serhiy Storchaka date: Fri Oct 31 01:37:03 2014 +0200 files: Lib/re.py description: Fixed compile error in issue #22410. The _locale module is optional. diff -r bc4dd43b847b -r 1d87ac92b041 Lib/re.py --- a/Lib/re.py Fri Oct 31 00:58:49 2014 +0200 +++ b/Lib/re.py Fri Oct 31 01:37:03 2014 +0200 @@ -122,7 +122,10 @@ import sys import sre_compile import sre_parse -import _locale +try: + import _locale +except ImportError: + _locale = None # public symbols __all__ = [ @@ -292,6 +295,8 @@ if len(_cache) >= _MAXCACHE: _cache.clear() if p.flags & LOCALE: + if not _locale: + return p loc = _locale.setlocale(_locale.LC_CTYPE) else: loc = None