[PySide] strange module init code?

Matthew Woehlke matthew.woehlke at kitware.com
Thu Jun 27 23:21:29 CEST 2013

I have a generated my_module_wrapper.cpp with code like:

   Shiboken::AutoDecRef requiredModule(
   if (requiredModule.isNull())

This generates a warning:

my_module_wrapper.cpp: warning: suggest braces around empty body in an 
‘if’ statement [-Wempty-body]

Looking at SBK_MODULE_INIT_ERROR, it appears to be defined to either 
empty or '0' depending on Python major version. As such, the above code 
makes no sense; it is either a useless if() with empty body, or useless 
if() with the body '0;' (which generates a 'statement has no effect' 

This doesn't seem right... should this be instead throwing an exception 
(Py_FatalError) or something? Or maybe there is a 'return' missing?

(Note: from what I can tell, SBK_MODULE_INIT_ERROR is meant to be used 
after 'return'. Actually, it looks like this *is* supposed to return, 
and lost the 'return' in 0b1f8df5.)


More information about the PySide mailing list