[PySide] strange module init code?

Matthew Woehlke matthew.woehlke at kitware.com
Fri Jun 28 00:26:45 CEST 2013


On 2013-06-27 18:16, John Ehresman wrote:
> On 6/27/13 4:21 PM, Matthew Woehlke wrote:
>> I have a generated my_module_wrapper.cpp with code like:
>>
>>      Shiboken::AutoDecRef requiredModule(
>>        Shiboken::Module::import("PySide.QtCore"));
>>      if (requiredModule.isNull())
>>        SBK_MODULE_INIT_ERROR;
>> ...
>> This doesn't seem right... should this be instead throwing an exception
>> (Py_FatalError) or something? Or maybe there is a 'return' missing?
>
> This should raise a python exception and then simply return under Python
> 2 and return NULL under Python 3.  It should be possible to continue
> after a import of a dependent import fails.

Both the exception and the return seem to be missing. I have a patch to 
(re-)add the return, if you would like?

Unless you ask, I'm inclined to let you add an exception. (There wasn't 
one prior to 0b1f8df5, either. Possibly there never was...)

-- 
Matthew




More information about the PySide mailing list