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.

classification
Title: sre bug: lastmark_save/restore
Type: behavior Stage: resolved
Components: Extension Modules, Regular Expressions Versions: Python 3.11
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: abacabadabacaba, ezio.melotti, malin, serhiy.storchaka, xtreak
Priority: normal Keywords:

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 issue35859 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:03adminsetgithub: 53380
2022-03-29 15:30:16serhiy.storchakasetstatus: open -> closed
versions: + Python 3.11, - Python 2.7, Python 3.7, Python 3.8
messages: + msg416267

resolution: out of date
stage: needs patch -> resolved
2019-02-18 14:49:49serhiy.storchakasetnosy: + malin

versions: + Python 3.8, - Python 3.6
2018-09-23 17:18:16arigosetnosy: - arigo
2018-09-23 15:03:19xtreaksetnosy: + xtreak
2017-11-16 13:28:44serhiy.storchakasetassignee: serhiy.storchaka
versions: + Python 3.6, Python 3.7, - Python 3.4, Python 3.5
2015-03-17 18:49:23abacabadabacabasetnosy: + abacabadabacaba
2014-08-01 13:57:25arigosetmessages: + msg224502
2014-08-01 13:38:32serhiy.storchakasetversions: + Python 3.5, - Python 3.3
nosy: + serhiy.storchaka

messages: + msg224499

stage: test needed -> needs patch
2013-03-28 10:41:27georg.brandlsetversions: + Python 3.3, Python 3.4
2010-07-01 08:33:59arigosetmessages: + msg109034
2010-06-30 22:03:48ezio.melottisetnosy: + ezio.melotti

type: behavior
components: + Regular Expressions
stage: test needed
2010-06-30 21:18:56arigocreate