This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author niemeyer
Recipients
Date 2003-04-27.13:28:05
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=7887

Greg, I think there are two different issues here.

One of them is related to a wrong behavior from
mark_save/restore(), which don't restore the stackbase
before restoring the marks. Asserts were afected because
they're the only recursive ops that can continue the loop,
but the problem would happen to any operation with the same
behavior. So, rather than hardcoding this into asserts, I
have changed mark_save/restore() to always restore the
stackbase before restoring the marks. This should fix these
two cases you presented:

>>> re.match('(a)(?:(?=(b)*)c)*', 'abb').groups()
>>> re.match('(a)((?!(b)*))*', 'abb').groups()

And was applied as:

Modules/_sre.c: 2.95
Lib/test/test_re.py: 1.41

The other issue is related to the asserts which are leaving
half-marked groups. While your solution does work, it
changes the current behavior, which is also compatible to
how perl works. I understand that individual groups matching
when the whole string doesn't match is atypical. OTOH, a
negative assertion *is* atypical, and IMO denying external
group access won't help the user to understand how it works.
In other words, I think it's better to have incomplete
support for the moment, than having none.
This way, we can think further about this, and look for an
elegant solution to fix that support, certainly including
some algorithm to check for half-marked groups.

Thank you very much for spotting these bugs, and submitting
a solution for them.
History
Date User Action Args
2007-08-23 14:12:38adminlinkissue725149 messages
2007-08-23 14:12:38admincreate