diff options
Diffstat (limited to 'Lib/re.py')
-rw-r--r-- | Lib/re.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -275,6 +275,8 @@ _cache = OrderedDict() _MAXCACHE = 512 def _compile(pattern, flags): # internal: compile pattern + if isinstance(flags, RegexFlag): + flags = flags.value try: return _cache[type(pattern), pattern, flags] except KeyError: @@ -331,6 +333,8 @@ copyreg.pickle(Pattern, _pickle, _compile) class Scanner: def __init__(self, lexicon, flags=0): from sre_constants import BRANCH, SUBPATTERN + if isinstance(flags, RegexFlag): + flags = flags.value self.lexicon = lexicon # combine phrases into a compound pattern p = [] |