Issue 9134: sre bug: lastmark_save/restore (original) (raw)

Created on 2010-06-30 21:18 by arigo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
x.py arigo,2010-06-30 21:18 Bug case
Messages (5)
msg109019 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2010-06-30 21:18
The re module is buggy is rare cases; see attached example script. The bug is caused by the macros LASTMARK_SAVE and LASTMARK_RESTORE which are sometimes used without the extra code that does if (state->repeat) {mark_save()/mark_restore()}. The bug appears by mis-reporting the position of groups within a repeated match (with * or +), notably the position of some groups that matched in older repetitions but (after some backtracking) not in newer ones.
msg109034 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2010-07-01 08:33
It's pretty trivial to turn my x.py into a unit test, of course.
msg224499 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-01 13:38
It looks as the nature of this bug is clear to you, Armin. Do you want to write a patch?
msg224502 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2014-08-01 13:57
It was clear to me four years ago. Now I'd have to dig again as much as you do.
msg416267 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-03-29 15:30
Fixed in together with other bugs, but the fix was only applied to 3.11, because that bug is old and the old behavior matches the behavior in some other engines (Perl and Java).
History
Date User Action Args
2022-04-11 14:57:03 admin set github: 53380
2022-03-29 15:30:16 serhiy.storchaka set status: open -> closedversions: + Python 3.11, - Python 2.7, Python 3.7, Python 3.8messages: + resolution: out of datestage: needs patch -> resolved
2019-02-18 14:49:49 serhiy.storchaka set nosy: + malinversions: + Python 3.8, - Python 3.6
2018-09-23 17🔞16 arigo set nosy: - arigo
2018-09-23 15:03:19 xtreak set nosy: + xtreak
2017-11-16 13:28:44 serhiy.storchaka set assignee: serhiy.storchakaversions: + Python 3.6, Python 3.7, - Python 3.4, Python 3.5
2015-03-17 18:49:23 abacabadabacaba set nosy: + abacabadabacaba
2014-08-01 13:57:25 arigo set messages: +
2014-08-01 13:38:32 serhiy.storchaka set versions: + Python 3.5, - Python 3.3nosy: + serhiy.storchakamessages: + stage: test needed -> needs patch
2013-03-28 10:41:27 georg.brandl set versions: + Python 3.3, Python 3.4
2010-07-01 08:33:59 arigo set messages: +
2010-06-30 22:03:48 ezio.melotti set nosy: + ezio.melottitype: behaviorcomponents: + Regular Expressionsstage: test needed
2010-06-30 21🔞56 arigo create