diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-10-31 01:31:33 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-10-31 01:31:33 +0200 |
commit | b89cf5efd58d6c506011933c7ec5782fb2a05bbc (patch) | |
tree | 6c079ae45eedbe5718e8b5ac49e402a945ad4b20 | |
parent | ccf87494cdb5ce39d5d168d64aa8c21852c742e3 (diff) | |
download | cpython-b89cf5efd58d6c506011933c7ec5782fb2a05bbc.tar.gz |
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
@@ -104,7 +104,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", "search", "sub", "subn", "split", "findall", @@ -250,6 +253,8 @@ def _compile(*key): if len(_cache) >= _MAXCACHE: _cache.clear() if p.flags & LOCALE: + if not _locale: + return p loc = _locale.setlocale(_locale.LC_CTYPE) else: loc = None |