diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-10-30 23:34:45 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-10-30 23:34:45 (GMT) |
commit | cf7b1cadd19762f63cff48713b5be7b0dd3f548e (patch) | |
tree | 063afe349714e30fd97d909c23a597ee1d0e197e /Lib | |
parent | d9b8dc272aed9d6d69ea51107ba0246e767f33d2 (diff) | |
download | cpython-cf7b1cadd19762f63cff48713b5be7b0dd3f548e.zip cpython-cf7b1cadd19762f63cff48713b5be7b0dd3f548e.tar.gz cpython-cf7b1cadd19762f63cff48713b5be7b0dd3f548e.tar.bz2 |
Fixed compile error in issue #22410. The _locale module is optional.
Diffstat (limited to 'Lib')
-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__ = [ "match", "fullmatch", "search", "sub", "subn", "split", "findall", @@ -293,6 +296,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 |