[issue31671] IntFlag makes re.compile slower

STINNER Victor report at bugs.python.org
Tue Oct 3 08:40:12 EDT 2017


STINNER Victor <victor.stinner at gmail.com> added the comment:

Oh, right. Strange.

>>> re.compile("e", flags=2.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/haypo/prog/python/master/Lib/re.py", line 240, in compile
    return _compile(pattern, flags)
  File "/home/haypo/prog/python/master/Lib/re.py", line 288, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/home/haypo/prog/python/master/Lib/sre_compile.py", line 747, in compile
    p = sre_parse.parse(p, flags)
  File "/home/haypo/prog/python/master/Lib/sre_parse.py", line 890, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
TypeError: unsupported operand type(s) for &: 'float' and 'int'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31671>
_______________________________________


More information about the Python-bugs-list mailing list