[PySide] cxfreeze and PySide 1.2.0

John Ehresman jpe at wingware.com
Wed Jul 10 21:28:57 CEST 2013

On 7/10/13 12:36 PM, Joel B. Mohler wrote:

> Aha, this has been an interesting journey to get this all compiled in
> debug.  I have found the problem.
>          Shiboken::AutoDecRef atexit(Shiboken::Module::import("atexit"));
>          Shiboken::AutoDecRef regFunc(PyObject_GetAttrString(atexit,
> "register"));
> This C-level module import in qtcore_module_wrapper.cpp imports python
> module atexit, but it fails and so the second line crashes because
> atexit is null.  So, easy fix is to include "--include-modules=atexit"
> in the cxfreeze command line.

Yes, that's the way to avoid triggering the bug.

> So, what is the correct fix?  I think that import in sbkmodule.cpp does
> right to set the PyErr, but the calling code copied above originating
> from typesystem_core_common.xml (I think?) doesn't check PyErr_Occurred
> and I don't know how the error should propagate in the abstract
> conditions of typesystem_core_common.xml.

The code needs to check if atexit is NULL and possibly just print a 
warning and continue without registering the handler.  The problem is 
that segfaults can occur at shutdown (I think) if the handler isn't run.

Thanks for tracking this down!


More information about the PySide mailing list