Roundup Robot added the comment:
New changeset b78195af96f5 by Serhiy Storchaka in branch 'default':
Issues #814253, #9179: Group references and conditional group references now
https://hg.python.org/cpython/rev/b78195af96f5
New changeset 5387095b8675 by Serhiy Storchaka in branch '2.7':
Issues
Serhiy Storchaka added the comment:
Only warnings are raised in 2.7 and 3.4, so it will not break third party code
that works by accident. In 3.5 only references to groups defined outside of
lookbehind assertion work, so the behavior is compatible with regex.
--
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
Changes by Benjamin Peterson benja...@python.org:
--
priority: release blocker - normal
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
___
Serhiy Storchaka added the comment:
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
Roundup Robot added the comment:
New changeset d1f7c3f45ffe by Benjamin Peterson in branch '3.4':
backout 9fcf4008b626 (#9179) for further consideration
https://hg.python.org/cpython/rev/d1f7c3f45ffe
New changeset f385bc6e6e09 by Benjamin Peterson in branch 'default':
merge 3.4 (#9179)
Benjamin Peterson added the comment:
I just backed out the change. Thanks for brining up the issue.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
Serhiy Storchaka added the comment:
What would be the best solution for 2.7?
Here is a patch which forbids any group references in lookbehind assertions
(they are not work currently and users shouldn't use them).
--
stage: - patch review
Added file:
Benjamin Peterson added the comment:
On Sun, Nov 30, 2014, at 12:55, Serhiy Storchaka wrote:
Serhiy Storchaka added the comment:
What would be the best solution for 2.7?
You can pick. I just always favor not changing things for release
candidates.
Here is a patch which forbids any
Serhiy Storchaka added the comment:
Updated documentation. If there are no objections I'll commit
re_forbid_groupref_in_lookbehind-2.7_2.patch to 2.7 and 3.4. For 3.5 I prefer
to add support of group references.
--
Added file:
Roundup Robot added the comment:
New changeset fac649bf2d10 by Serhiy Storchaka in branch '2.7':
Issues #814253, #9179: Group references and conditional group references now
https://hg.python.org/cpython/rev/fac649bf2d10
New changeset 9fcf4008b626 by Serhiy Storchaka in branch '3.4':
Issues
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
Serhiy Storchaka added the comment:
If there are no objections I'm going to commit the patch soon.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
Serhiy Storchaka added the comment:
The patch also fixes issue814253.
If there are no objections I'll commit it soon.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
Serhiy Storchaka added the comment:
Here is a patch which fixes lookbacks with group references and with group
conditionals. I have used Andrew's examples as the base for tests.
--
assignee: - serhiy.storchaka
components: +Regular Expressions
keywords: +patch
nosy: +ezio.melotti
Mark Lawrence added the comment:
Given the comment from Matthew Barnett in msg109399 ...I had a look at the re
module, found it too difficult... can this be closed as won't fix?
--
nosy: +BreamoreBoy, serhiy.storchaka
___
Python tracker
New submission from andrew cooke and...@acooke.org:
from re import compile
# these work as expected
assert compile('(a)b(?=b)(c)').match('abc')
assert not compile('(a)b(?=c)(c)').match('abc')
assert compile('(a)b(?=c)(c)').match('abc')
assert not compile('(a)b(?=b)(c)').match('abc')
# but
andrew cooke and...@acooke.org added the comment:
I hope the above is clear enough (you need to stare at the regexps for a time)
- basically, lookback with a group conditional is not as expected (it appears
to be evaluated as lookahead?). Also, some patterns compile that probably
shouldn't.
andrew cooke and...@acooke.org added the comment:
If it's any help, these are the equivalent tests as I think they should be
(you'll need to translate engine(parse(... to compile(...)
Mark Dickinson dicki...@gmail.com added the comment:
Thanks very much for the reports.
So I guess it's also possible that (?(n)pat1|pat2) should always fail
that, even when len(pat1) = len(pat2)?
Yes, this seems likely to me. Possibly even the compile stage should fail,
though I've no idea
Changes by Mark Dickinson dicki...@gmail.com:
--
versions: +Python 2.7, Python 3.1, Python 3.2
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
andrew cooke and...@acooke.org added the comment:
I thought someone was working on the re module these days? I thought there I'd
seen some issues with patches etc?
Anyway, short term, sorry - no patch. Medium/long term, yes it's possible, but
please don't rely on it.
The simplest way to
Mark Dickinson dicki...@gmail.com added the comment:
I thought someone was working on the re module these days?
Well, there's issue 2636. It doesn't seem likely that that work will land in
core Python any time soon, though.
--
___
Python tracker
Matthew Barnett pyt...@mrabarnett.plus.com added the comment:
Should a regex compile if a group is referenced before it's defined?
Consider this:
(?:(?(2)(a)|(b))+
Other regex implementations permit forward references to groups.
BTW, I had a look at the re module, found it too difficult,
andrew cooke and...@acooke.org added the comment:
Ah good point, thanks.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9179
___
___
25 matches
Mail list logo