[PyKDE] Bug (or feature?) in sipParseArgs

Donovan Rebbechi elflord at andromeda.rutgers.edu
Thu Jun 27 09:06:00 BST 2002


I noticed a curious feature in sipParseArgs recently-- sometimes, it
leaves the error handler with a "dangling error" set when it returns false.
Judging by the code in parsePass1(), and the idiomatic usage in generated code
where several blocks are tried one after the other, this looks like a
mistake.  It certainly resulted in some interesting and obscure bugs in
my code ;-)

I took a look at the code (sip 3.2.4) and PyErr_Clear() is called at the
top of the loop, but not before the exit of the function, which means that
if the last loop iteration sets a python exception, the function exits in
that state.

The fix that addresses this is to call PyErr_Clear() at the end of ParsePass1()

Cheers,
-- 
Donovan




More information about the PyQt mailing list