[PySide] The structure of type objects has changed!

Alexandru Croitor alexandru.croitor at qt.io
Fri Oct 12 16:24:12 CEST 2018


Hi,

It's a bug in the PySide2 code when building with debug interpreter on Windows.

I encountered the same, and had a local dirty fix.

You want to modify sources/shiboken2/libshiboken/pep384impl.cpp
and comment out the if ( .... probe_tp_name - check->tp_name != 0) line.

Consider opening a bug report, so we don't forget about it.




> On 12. Oct 2018, at 15:37, Olivier B. <perso.olivier.barthelemy at gmail.com> wrote:
> 
> I am getting this fatal error when importing PySide2 from a debug
> python on windows
> 
> Environment :
> I build my own python 3.5.2, Qt 5.11.1, and PySide2 5.11.1 (of july
> 27th), in a release and a debug build,
> with the same compiler, VS2015 on windows  and GCC 4.8 on Linux
> 
> On Linux, i can import PySide2 with my release and my debug python
> On windows, i can do it with the release python, but get the following
> error for the debug python
> 
> The console says
> Fatal Python error: The structure of type objects has changed!
> Current thread 0x0000367c (most recent call first):
>  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
>  File "<frozen importlib._bootstrap_external>", line 906 in create_module
>  File "<frozen importlib._bootstrap>", line 577 in module_from_spec
>  File "<frozen importlib._bootstrap>", line 666 in _load_unlocked
>  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
>  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
>  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
>  File "<frozen importlib._bootstrap_external>", line 906 in create_module
>  File "<frozen importlib._bootstrap>", line 577 in module_from_spec
>  File "<frozen importlib._bootstrap>", line 666 in _load_unlocked
>  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
>  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
>  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
>  File "<frozen importlib._bootstrap>", line 1016 in _handle_fromlist
>  File "C:\...\python-3.5.2\lib\site-packages\PySide2\__init__.py",
> line 39 in _setupQtDirectories
>  File "C:\...\python-3.5.2\lib\site-packages\PySide2\__init__.py",
> line 47 in <module>
>  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
>  File "<frozen importlib._bootstrap_external>", line 665 in exec_module
>  File "<frozen importlib._bootstrap>", line 673 in _load_unlocked
>  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
>  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
>  File "<stdin>", line 1 in <module>
> 
> The call stack when it happens, triggered by the import of QNetwork
> from __init.py__:39
>  python35_d.dll!Py_FatalError(const char * msg) Line 1399 C
>  shiboken2_d.cp35-win_amd64.dll!check_PepTypeObject_valid() Line 441 C++
>  shiboken2_d.cp35-win_amd64.dll!Pep384_Init() Line 837 C++
>  shiboken2_d.cp35-win_amd64.dll!Shiboken::init() Line 554 C++
>  shiboken2_d.cp35-win_amd64.dll!Shiboken::Module::create(const char *
> moduleName, void * moduleData) Line 81 C++
>  QtCore_d.cp35-win_amd64.pyd!PyInit_QtCore() Line 4110 C++
>  python35_d.dll!_PyImport_LoadDynamicModuleWithSpec(_object * spec,
> _iobuf * fp) Line 150 C
>  python35_d.dll!_imp_create_dynamic_impl(PyModuleDef * module,
> _object * spec, _object * file) Line 2027 C
>  python35_d.dll!_imp_create_dynamic(PyModuleDef * module, _object *
> args) Line 282 C
>  python35_d.dll!PyCFunction_Call(_object * func, _object * args,
> _object * kwds) Line 109 C
>  python35_d.dll!ext_do_call(_object * func, _object * * * pp_stack,
> int flags, int na, int nk) Line 5032 C
>  python35_d.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3278 C
>  python35_d.dll!_PyEval_EvalCodeWithName(_object * _co, _object *
> globals, _object * locals, _object * * args, int argcount, _object * *
> kws, int kwcount, _object * * defs, int defcount, _object * kwdefs,
> _object * closure, _object * name, _object * qualname) Line 4018 C
>  python35_d.dll!fast_function(_object * func, _object * * * pp_stack,
> int n, int na, int nk) Line 4818 C
>  python35_d.dll!call_function(_object * * * pp_stack, int oparg) Line 4730 C
>  python35_d.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3238 C
>  python35_d.dll!fast_function(_object * func, _object * * * pp_stack,
> int n, int na, int nk) Line 4804 C
>  python35_d.dll!call_function(_object * * * pp_stack, int oparg) Line 4730 C
>  python35_d.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3238 C
>  python35_d.dll!fast_function(_object * func, _object * * * pp_stack,
> int n, int na, int nk) Line 4804 C
>  python35_d.dll!call_function(_object * * * pp_stack, int oparg) Line 4730 C
>  python35_d.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3238 C
>  python35_d.dll!fast_function(_object * func, _object * * * pp_stack,
> int n, int na, int nk) Line 4804 C
>  python35_d.dll!call_function(_object * * * pp_stack, int oparg) Line 4730 C
>  python35_d.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3238 C
>  python35_d.dll!fast_function(_object * func, _object * * * pp_stack,
> int n, int na, int nk) Line 4804 C
>  python35_d.dll!call_function(_object * * * pp_stack, int oparg) Line 4730 C
>  python35_d.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3238 C
>  python35_d.dll!_PyEval_EvalCodeWithName(_object * _co, _object *
> globals, _object * locals, _object * * args, int argcount, _object * *
> kws, int kwcount, _object * * defs, int defcount, _object * kwdefs,
> _object * closure, _object * name, _object * qualname) Line 4018 C
>  python35_d.dll!PyEval_EvalCodeEx(_object * _co, _object * globals,
> _object * locals, _object * * args, int argcount, _object * * kws, int
> kwcount, _object * * defs, int defcount, _object * kwdefs, _object *
> closure) Line 4043 C
>  python35_d.dll!function_call(_object * func, _object * arg, _object
> * kw) Line 627 C
>  python35_d.dll!PyObject_Call(_object * func, _object * arg, _object
> * kw) Line 2165 C
>  python35_d.dll!_PyObject_CallMethodIdObjArgs(_object * callable,
> _Py_Identifier * name, ...) Line 2423 C
>  python35_d.dll!PyImport_ImportModuleLevelObject(_object * name,
> _object * given_globals, _object * locals, _object * given_fromlist,
> int level) Line 1595 C
>  python35_d.dll!builtin___import__(_object * self, _object * args,
> _object * kwds) Line 215 C
>  python35_d.dll!PyCFunction_Call(_object * func, _object * args,
> _object * kwds) Line 98 C
>  python35_d.dll!PyObject_Call(_object * func, _object * arg, _object
> * kw) Line 2165 C
>  python35_d.dll!call_function_tail(_object * callable, _object *
> args) Line 2191 C
>  python35_d.dll!PyObject_CallFunction(_object * callable, const char
> * format, ...) Line 2218 C
>  python35_d.dll!PyImport_Import(_object * module_name) Line 1800 C
>  python35_d.dll!PyImport_ImportModule(const char * name) Line 1263 C
>  shiboken2_d.cp35-win_amd64.dll!Shiboken::Module::import(const char *
> moduleName) Line 67 C++
>> QtNetwork_d.cp35-win_amd64.pyd!PyInit_QtNetwork() Line 1125 C++
>  python35_d.dll!_PyImport_LoadDynamicModuleWithSpec(_object * spec,
> _iobuf * fp) Line 150 C
> 
> What kind of cause could make check_PepTypeObjectValid() to fail?
> The proper Qt dlls and PySide pyd files seem loaded from my point of view.
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside




More information about the PySide mailing list