[Python-checkins] r66364 - in python/trunk: Lib/test/test_re.py Misc/NEWS Modules/_sre.c

Guido van Rossum guido at python.org
Wed Sep 10 18:15:20 CEST 2008


D'oh. Fixed. (svn propedit -r66364 svn:log)
On Wed, Sep 10, 2008 at 7:46 AM, Eric Smith <eric at trueblade.com> wrote:
> Because the log message says a different issue:
>> Issue #3751: str.rpartition would perform a left-partition when called
> with a unicode argument. Reviewed by Amaury.
>> Guido van Rossum wrote:
>>>> Why do you think so? http://bugs.python.org/issue3629 == "Python won't
>> compile a regex that compiles with 2.5.2 and 30b2" and that's what
>> this change fixes.
>>>> On Wed, Sep 10, 2008 at 7:32 AM, Eric Smith <eric at trueblade.com> wrote:
>>>>>> I think the comment references the wrong issue (and wrong description).
>>>>>> Eric.
>>>>>> guido.van.rossum wrote:
>>>>>>>> Author: guido.van.rossum
>>>> Date: Wed Sep 10 16:27:00 2008
>>>> New Revision: 66364
>>>>>>>> Log:
>>>> Issue #3751: str.rpartition would perform a left-partition when called
>>>> with
>>>> a unicode argument. Reviewed by Amaury.
>>>>>>>>>>>> Modified:
>>>> python/trunk/Lib/test/test_re.py
>>>> python/trunk/Misc/NEWS
>>>> python/trunk/Modules/_sre.c
>>>>>>>> Modified: python/trunk/Lib/test/test_re.py
>>>>>>>>>>>> ==============================================================================
>>>> --- python/trunk/Lib/test/test_re.py (original)
>>>> +++ python/trunk/Lib/test/test_re.py Wed Sep 10 16:27:00 2008
>>>> @@ -116,6 +116,10 @@
>>>> self.assertRaises(ValueError, re.findall, pattern, 'A', re.I)
>>>> self.assertRaises(ValueError, re.compile, pattern, re.I)
>>>> + def test_bug_3629(self):
>>>> + # A regex that triggered a bug in the sre-code validator
>>>> + re.compile("(?P<quote>)(?(quote))")
>>>> +
>>>> def test_sub_template_numeric_escape(self):
>>>> # bug 776311 and friends
>>>> self.assertEqual(re.sub('x', r'0円', 'x'), '0円')
>>>>>>>> Modified: python/trunk/Misc/NEWS
>>>>>>>>>>>> ==============================================================================
>>>> --- python/trunk/Misc/NEWS (original)
>>>> +++ python/trunk/Misc/NEWS Wed Sep 10 16:27:00 2008
>>>> @@ -68,6 +68,8 @@
>>>> Library
>>>> -------
>>>> +- Issue #3629: Fix sre "bytecode" validator for an end case.
>>>> +
>>>> - Issue #3811: The Unicode database was updated to 5.1.
>>>> - Issue #3809: Fixed spurious 'test.blah' file left behind by
>>>> test_logging.
>>>>>>>> Modified: python/trunk/Modules/_sre.c
>>>>>>>>>>>> ==============================================================================
>>>> --- python/trunk/Modules/_sre.c (original)
>>>> +++ python/trunk/Modules/_sre.c Wed Sep 10 16:27:00 2008
>>>> @@ -2781,17 +2781,18 @@
>>>> arg = *code++; \
>>>> VTRACE(("%lu (arg)\n", (unsigned long)arg)); \
>>>> } while (0)
>>>> -#define GET_SKIP \
>>>> +#define GET_SKIP_ADJ(adj) \
>>>> do { \
>>>> VTRACE(("%p= ", code)); \
>>>> if (code >= end) FAIL; \
>>>> skip = *code; \
>>>> VTRACE(("%lu (skip to %p)\n", \
>>>> (unsigned long)skip, code+skip)); \
>>>> - if (code+skip < code || code+skip > end) \
>>>> + if (code+skip-adj < code || code+skip-adj > end)\
>>>> FAIL; \
>>>> code++; \
>>>> } while (0)
>>>> +#define GET_SKIP GET_SKIP_ADJ(0)
>>>> static int
>>>> _validate_charset(SRE_CODE *code, SRE_CODE *end)
>>>> @@ -3098,7 +3099,7 @@
>>>> GET_ARG;
>>>> if (arg >= groups)
>>>> FAIL;
>>>> - GET_SKIP;
>>>> + GET_SKIP_ADJ(1);
>>>> code--; /* The skip is relative to the first arg! */
>>>> /* There are two possibilities here: if there is both a
>>>> 'then'
>>>> part and an 'else' part, the generated code looks like:
>>>> _______________________________________________
>>>> Python-checkins mailing list
>>>> Python-checkins at python.org
>>>> http://mail.python.org/mailman/listinfo/python-checkins
>>>>>>> _______________________________________________
>>> Python-checkins mailing list
>>> Python-checkins at python.org
>>> http://mail.python.org/mailman/listinfo/python-checkins
>>>>>>>>>>>
-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /