Message231889
The more I think about it, the more doubt. This patch added a behavior that is incompatible with the regex module. The regex module proceeds lookbehind assertions in the opposite direction, from right to left. This allows it to work with lookbehind assertions of non-fixed length. But the side effect is that in regex group reference in lookbehind assertion can refer only to a group defined right in the same lookbehind assertion (or defined left outside). In re now group reference in lookbehind assertion can refer only to a group defined left. This is likely to change in the future, which brings us to the problem of incompatibility.
There are several quick ways to resolve the problem:
1) Rollback the patch and return to the previous non-working behavior. Because of the obvious non-working the problem with changing the implementation of lookbehind assertion in the future will be weaker.
2) Rollback the patch and emit a warning or error when using any group references in lookbehind assertion. Something like patch proposed by Greg Chapman in issue814253 (but slightly more advanced).
3) Leave the patch and emit a warning or an error when using group references to the group defined in this same lookbehind assertion. Group references will work in lookbehind assertions in most cases except rare cases when current re behavior differs from regex behavior.
What is your decision Benjamin?
Here is a patch against 2.7 which implements variant 3. |
|
Date |
User |
Action |
Args |
2014-11-30 15:30:57 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, mark.dickinson, larry, benjamin.peterson, ezio.melotti, acooke, mrabarnett, BreamoreBoy, python-dev |
2014-11-30 15:30:57 | serhiy.storchaka | set | messageid: <1417361457.47.0.84516778483.issue9179@psf.upfronthosting.co.za> |
2014-11-30 15:30:57 | serhiy.storchaka | link | issue9179 messages |
2014-11-30 15:30:57 | serhiy.storchaka | create | |
|