diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-10-30 23:37:03 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-10-30 23:37:03 (GMT) |
commit | 3bf7a6c1dada9842fb0d53ac3818f20540933c8f (patch) | |
tree | c16bfb7f122eb60d8bc00c0155a04df28b3438c5 | |
parent | 92f56a8d703128d16e1ed92df2b7df5d035d62d1 (diff) | |
parent | cf7b1cadd19762f63cff48713b5be7b0dd3f548e (diff) | |
download | cpython-3bf7a6c1dada9842fb0d53ac3818f20540933c8f.zip cpython-3bf7a6c1dada9842fb0d53ac3818f20540933c8f.tar.gz cpython-3bf7a6c1dada9842fb0d53ac3818f20540933c8f.tar.bz2 |
Fixed compile error in issue #22410. The _locale module is optional.
-rw-r--r-- | Lib/re.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -122,7 +122,10 @@ This module also defines an exception 'error'. import sys import sre_compile import sre_parse -import _locale +try: + import _locale +except ImportError: + _locale = None # public symbols __all__ = [ @@ -292,6 +295,8 @@ def _compile(pattern, flags): if len(_cache) >= _MAXCACHE: _cache.clear() if p.flags & LOCALE: + if not _locale: + return p loc = _locale.setlocale(_locale.LC_CTYPE) else: loc = None |