[Python-Dev] Py_DECREF causes spurious gcc warning

Zack Weinberg zack at codesourcery.com
Sat Dec 20 14:02:27 EST 2003


martin at v.loewis.de (Martin v. Löwis) writes:

> "Zack Weinberg" <zack at codesourcery.com> writes:
>
>> It does, however, lead to a different problem:
>> 
>>   if (condition)
>>     Py_DECREF (foo);
>>   else               // oops, syntax error here
>
> How so? This expands to
>
> if(condition)
>   if(cond2)action1;
>   else action2;
> else

No, it expands to

 if(condition)
  if(cond2) action1;
  else action2;;
 else

-- note the extra semicolon, which provokes a syntax error.

zw



More information about the Python-Dev mailing list