Hi,
I have discovered strange bahaviour while testing qtdemo.py under Python 3.2.
Plase look at sample code and the comment prefixed XXX:
>>>
from PySide import QtCore
class MenuManager(QtCore.QObject):
pInstance = None
@classmethod
def instance(cls):
if cls.pInstance is None:
cls_inst = cls()
cls.pInstance = cls_inst
# XXX: the cls.pInstance is None but cls_inst is NOT None !!!
return cls.pInstance
# This will allways return None under Python 3.2
menuManagerInstance = MenuManager.instance()
print(menuManagerInstance)
<<<
Under Python 2.6 and 2.7 the code work as expected (cls.pInstance is NOT None)
If MenuManager inherits from object it will work (class
MenuManager(object)), so there is something wrong with QObject
wrapper...
Under PyQt4 it works fine.
I have absolutely no idea what is going on here.
Regards
Roman
_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside