[Python-Dev] [Python-checkins] cpython (3.3): check the return value of new_string() (closes #18470)

Benjamin Peterson benjamin at python.org
Tue Jul 16 05:55:16 CEST 2013


2013/7/15 Victor Stinner <victor.stinner at gmail.com>:
> 2013/7/16 benjamin.peterson <python-checkins at python.org>:
>> http://hg.python.org/cpython/rev/c3a510b22218
>> changeset:   84653:c3a510b22218
>> branch:      3.3
>> parent:      84651:e22dd5fda5a8
>> user:        Benjamin Peterson <benjamin at python.org>
>> date:        Mon Jul 15 19:15:34 2013 -0700
>> summary:
>>   check the return value of new_string() (closes #18470)
>>
>> ...
>>
>>
>> diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
>> --- a/Parser/tokenizer.c
>> +++ b/Parser/tokenizer.c
>> @@ -250,17 +253,21 @@
>>                  t++;
>>
>>              if (begin < t) {
>> -                char* r = new_string(begin, t - begin);
>> +                char* r = new_string(begin, t - begin, tok);
>> +                if (!r)
>> +                    return 0;
>>                  char* q = get_normal_name(r);
>> ...
>
> Visual Studio does support instructions between declarations, and so
> this changeset broke Windows buildbots.

Fixed.

>
> Should we add the "-Werror=declaration-after-statement" compiler flag
> to the 3.3 branch? (in debug mode?)

We've lived with this limitation for years. I'm sure we can wait until
3.4 becomes maintenance. :)


--
Regards,
Benjamin


More information about the Python-Dev mailing list