[Python-Dev] [Python-checkins] cpython (merge 3.3 -> default): Silence warning about set but unused variable inside compile_atom() in

Christian Heimes christian at python.org
Thu Aug 1 09:49:32 CEST 2013


Am 01.08.2013 09:03, schrieb Ronald Oussoren:
> 
> On 31 Jul, 2013, at 23:50, christian.heimes <python-checkins at python.org> wrote:
> 
>> http://hg.python.org/cpython/rev/0e09588a3bc2
>> changeset:   84939:0e09588a3bc2
>> parent:      84937:809a64ecd5f1
>> parent:      84938:83a55ca935f0
>> user:        Christian Heimes <christian at cheimes.de>
>> date:        Wed Jul 31 23:48:04 2013 +0200
>> summary:
>>  Silence warning about set but unused variable inside compile_atom() in non-debug builds
>>
>> files:
>>  Parser/pgen.c |  1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>>
>> diff --git a/Parser/pgen.c b/Parser/pgen.c
>> --- a/Parser/pgen.c
>> +++ b/Parser/pgen.c
>> @@ -283,6 +283,7 @@
>>
>>     REQ(n, ATOM);
>>     i = n->n_nchildren;
>> +    (void)i; /* Don't warn about set but unused */
>>     REQN(i, 1);
> 
> Why didn't you change this to  "REQN(n->nchilderen, 1);" (and then remove variable "i")? 
> 
> Ronald
> 
>>     n = n->n_child;
>>     if (n->n_type == LPAR) {

It doesn't work because a few lines later the code does:

    n = n->n_child;
    if (n->n_type == LPAR) {
        REQN(i, 3);

n is no longer the right n and REQN(i, 3) would fail.

Christian



More information about the Python-Dev mailing list