Author serhiy.storchaka
Recipients ezio.melotti, larry, mrabarnett, pitrou, serhiy.storchaka
Date 2013-08-03.20:42:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375562527.29.0.365652198395.issue18647@psf.upfronthosting.co.za>
In-reply-to
Content
Now all doctests failed on 32-bit platforms due to the unlucky coincidence of my patch with at least two bugs which were hided before.

SubPattern.getwidth() is wrong, it truncates resulted values to sys.maxsize (should be MAXREPEAT). As side effect of my patch (on 32-bit MAXREPEAT == sys.maxsize) it now returns correct value in some cases on 32-bit platforms. On other hand, the _simple() function in sre_compile.py checks if getwidth() returns (0, MAXREPEAT) and raise an error in such case. Perhaps it should guards against such patterns as '(x*)*' (but it doesn't guards against '(x*y?)*' or '(x*y*)*' and can raise false positive). Now getwidth() returns (0, MAXREPEAT) for '(x*y?)*' on 32-bit platforms (this is a correct result) and triggers the check. The doctest module uses regular expression pattern '(?:.*$\n?)*' which now causes an error.

Definitely SubPattern.getwidth() is wrong and should be fixed. At least one of two, the _simple() function or doctest pattern should be fixed too. The simplest fix is disable the 'nothing to repeat' check.
History
Date User Action Args
2013-08-03 20:42:07serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, larry, ezio.melotti, mrabarnett
2013-08-03 20:42:07serhiy.storchakasetmessageid: <1375562527.29.0.365652198395.issue18647@psf.upfronthosting.co.za>
2013-08-03 20:42:07serhiy.storchakalinkissue18647 messages
2013-08-03 20:42:07serhiy.storchakacreate