Error handling bug in evalFile?
Dynamic Python binding for Qt Applications
Brought to you by:
florianlink,
marcusbarann
I believe there may be a bug in how error handling is done for evalFile. Introducing a blatant python parsing error and calling evalFile, then calling PythonQt::self()->hadError() does not indicate that an error occurred. The error is written to stderr, however. I have isolated why this occurs to the evalFile function. The error is properly set in parseFile. Since handleError calls Py_ErrClear, when the error is cleared and handleError called again in evalFile, the error is no longer indicated. Removing the clearError and handleError calls from evalFile made it so it properly detects the error. Is this the proper way to fix it so evalFile properly sets the error flag?
For reference, here's the code for evalFile and parseFile.
Thanks for reporting, I will fix this.
This has been fixed on the svn trunk.