Commit 3bf7a6c1 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed compile error in issue #22410. The _locale module is optional.

parents 92f56a8d cf7b1cad
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment