[Python-checkins] cpython (2.7): Fixed compile error in issue #22410. The _locale module is optional.
serhiy.storchaka
python-checkins at python.org
Fri Oct 31 00:39:45 CET 2014
https://hg.python.org/cpython/rev/d565dbf576f9
changeset: 93296:d565dbf576f9
branch: 2.7
parent: 93291:6d2788f9b20a
user: Serhiy Storchaka <storchaka at gmail.com>
date: Fri Oct 31 01:31:33 2014 +0200
summary:
Fixed compile error in issue #22410. The _locale module is optional.
files:
Lib/re.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Lib/re.py b/Lib/re.py
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -104,7 +104,10 @@
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 @@
if len(_cache) >= _MAXCACHE:
_cache.clear()
if p.flags & LOCALE:
+ if not _locale:
+ return p
loc = _locale.setlocale(_locale.LC_CTYPE)
else:
loc = None
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list