[issue35859] Capture behavior depends on the order of an alternation

Ma Lin report at bugs.python.org
Wed Jan 30 22:28:20 EST 2019


Ma Lin <malincns at 163.com> added the comment:

You can `#define VERBOSE` in file `_sre.c`, it will print the engine's actual actions:

|02FAC684|02FC7402|MARK 0
...
|02FAC6BC|02FC7401|MARK 1

In my computer, 02FC7400 points to "ab", 02FC7401 points 'b' in "ab", 02FC7402 points to the end of "ab".

This capture group, begin at 02FC7402, end at 02FC7401. `begin > end` makes it return an empty string.

This seems a bug, the begin should at 02FC7400.

----------

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


More information about the Python-bugs-list mailing list