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

Victor Stinner victor.stinner at gmail.com
Tue Jul 16 04:40:49 CEST 2013


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.

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

Victor


More information about the Python-checkins mailing list