[PySide] [Stackless] PySide problem, take #2: typeobject clash
Christian Tismer
tismer at stackless.com
Mon Oct 28 00:58:34 CET 2013
On 25.10.13 20:01, John Ehresman wrote:
> On 10/22/13 3:42 PM, Christian Tismer wrote:
>>> That would really be a minimal patch with much less ugliness and
>>> clutter.
>>> Well, not sure yet if I want to try that really right now...maybe
>>
>> Tried this -- does not work.
>> While a good idea, the introduced differences are too big to go away
>> with
>> this simple trick.
>> The thing breaks in for instance
>>
>>> /Users/tismer/src/pyside-setup/pyside_build/py2.7-qt4.8.5-64bit-release/pyside/PySide/QtCore/PySide/QtCore/qbitarray_wrapper.cpp:1626:38:
>>>
>>> error: no member named 'as_number' in 'SbkObjectType::<anonymous
>>> struct at
>>> /Users/tismer/src/pyside-setup/pyside_install/py2.7-qt4.8.5-64bit-release/include/shiboken/basewrapper.h:99:5>'
>>>
>>> memset(&Sbk_QBitArray_Type.super.as_number, 0,
>>> sizeof(PyNumberMethods));
>
> I looked at this a bit more and it's a bit of a mess (as many things
> with shiboken are so I'm not surprised). Looking at at, I think
> there's a good possibility the the use of PyHeapTypeObject isn't
> needed. The as_number initialization above can, I think, be replaced
> by declaring a static PyNumberMethods sruct and then setting the
> tp_as_number pointer to it. The same can be done for the other
> tp_as_* pointers.
>
> With this generation change, you shouldn't have any references to
> super.* fields other than super.ht_type.
Unfortunately it is more than that:
minimax:pyside-setup tismer$ grep -r ht_type sources/
sources//pyside/libpyside/pysidesignal.cpp: PyObject* typeDict = wrapperType->super.ht_type.tp_dict;
sources//pyside/PySide/phonon/typesystem_phonon.xml: PyDict_SetItemString(Sbk_Phonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "capabilitiesChanged", (PyObject*)signal_item);
sources//pyside/PySide/phonon/typesystem_phonon.xml: PyDict_SetItemString( Sbk_Phonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "availableAudioOutputDevicesChanged", (PyObject*)signal_item);
sources//pyside/PySide/QtGui/typesystem_gui_common.xml: PyDict_SetItemString(Sbk_QGraphicsItem_Type.super.ht_type.tp_dict, "UserType", userTypeConstant);
sources//shiboken/generator/shiboken/cppgenerator.cpp: s << ")->super.ht_type.tp_dict, \"" << enumValue->name() << "\", anonEnumItem) < 0)" << endl;
sources//shiboken/generator/shiboken/cppgenerator.cpp: s << INDENT << pyTypeName << ".super.ht_type.tp_as_number = &" << pyTypeName << ".super.as_number;" << endl;
sources//shiboken/generator/shiboken/cppgenerator.cpp: s << INDENT << pyTypeName << ".super.ht_type.tp_as_sequence = &" << pyTypeName << ".super.as_sequence;" << endl;
sources//shiboken/generator/shiboken/cppgenerator.cpp: s << INDENT << pyTypeName << ".super.ht_type.tp_as_mapping = &" << pyTypeName << ".super.as_mapping;" << endl;
sources//shiboken/generator/shiboken/cppgenerator.cpp: s << INDENT << "PyDict_SetItemString(" + cpythonTypeName(metaClass) + ".super.ht_type.tp_dict, \"";
sources//shiboken/generator/shiboken/shibokengenerator.cpp: code.replace("%PYTHONTYPEOBJECT", cpythonTypeName(context) + ".super.ht_type");
sources//shiboken/generator/shiboken/shibokengenerator.cpp: code.replace("%PYTHONTYPEOBJECT", cpythonTypeName(func->implementingClass()) + ".super.ht_type");
sources//shiboken/libshiboken/basewrapper.cpp: type->super.ht_type.tp_base = (PyTypeObject*)baseType;
sources//shiboken/libshiboken/basewrapper.cpp: type->super.ht_type.tp_bases = baseTypes;
sources//shiboken/libshiboken/basewrapper.h: PyTypeObject ht_type;
sources//shiboken/libshiboken/bindingmanager.cpp: file << '"' << (*j)->super.ht_type.tp_name << "\" -> \"" << node1->super.ht_type.tp_name << "\"\n";
sources//shiboken/libshiboken/sbkenum.cpp: if (enumType && PyDict_SetItemString(scope->super.ht_type.tp_dict, name, (PyObject*)enumType) < 0)
sources//shiboken/libshiboken/sbkenum.cpp: if (flagsType && PyDict_SetItemString(scope->super.ht_type.tp_dict, flagsType->tp_name, (PyObject*)flagsType) < 0)
sources//shiboken/libshiboken/sbkenum.cpp: if (PyDict_SetItemString(scope->super.ht_type.tp_dict, itemName, enumItem) < 0)
minimax:pyside-setup tismer$
At the moment, the alternative patch seems to be the one that gives
the minimum change so far.
cheers - chris
--
Christian Tismer :^) <mailto:tismer at stackless.com>
Software Consulting : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/
14482 Potsdam : PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776 fax +49 (30) 700143-0023
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the PySide
mailing list