@@ -264,6 +264,9 @@ void PythonQt::init(int flags, const QByteArray& pythonQtModuleName)
264
264
265
265
_self->priv ()->pythonQtModule ().addObject (" Debug" , _self->priv ()->_debugAPI );
266
266
267
+ Py_INCREF ((PyObject*)&PythonQtSlotDecorator_Type);
268
+ Py_INCREF ((PyObject*)&PythonQtSignalFunction_Type);
269
+ Py_INCREF ((PyObject*)&PythonQtProperty_Type);
267
270
PyModule_AddObject (pack, " Slot" , (PyObject*)&PythonQtSlotDecorator_Type);
268
271
PyModule_AddObject (pack, " Signal" , (PyObject*)&PythonQtSignalFunction_Type);
269
272
PyModule_AddObject (pack, " Property" , (PyObject*)&PythonQtProperty_Type);
@@ -695,6 +698,7 @@ PythonQtClassWrapper* PythonQtPrivate::createNewPythonQtClassWrapper(PythonQtCla
695
698
PyObject* className = PyString_FromString (pythonClassName.constData ());
696
699
697
700
PyObject* baseClasses = PyTuple_New (1 );
701
+ Py_INCREF ((PyObject*)&PythonQtInstanceWrapper_Type);
698
702
PyTuple_SET_ITEM (baseClasses, 0 , (PyObject*)&PythonQtInstanceWrapper_Type);
699
703
700
704
PyObject* typeDict = PyDict_New ();
@@ -1677,11 +1681,13 @@ void PythonQt::initPythonQtModule(bool redirectStdOut, const QByteArray& pythonQ
1677
1681
#ifdef PY3K
1678
1682
PythonQtModuleDef.m_name = name.constData ();
1679
1683
_p->_pythonQtModule = PyModule_Create (&PythonQtModuleDef);
1684
+ _PyImport_FixupBuiltin (_p->_pythonQtModule , name);
1680
1685
#else
1681
1686
_p->_pythonQtModule = Py_InitModule (name.constData (), PythonQtMethods);
1682
1687
#endif
1683
1688
_p->_pythonQtModuleName = name;
1684
-
1689
+
1690
+ Py_INCREF ((PyObject*)&PythonQtBoolResult_Type);
1685
1691
PyModule_AddObject (_p->pythonQtModule ().object (), " BoolResult" , (PyObject*)&PythonQtBoolResult_Type);
1686
1692
PythonQtObjectPtr sys;
1687
1693
sys.setNewRef (PyImport_ImportModule (" sys" ));
@@ -1705,16 +1711,14 @@ void PythonQt::initPythonQtModule(bool redirectStdOut, const QByteArray& pythonQ
1705
1711
Py_ssize_t old_size = PyTuple_Size (old_module_names);
1706
1712
PyObject *module_names = PyTuple_New (old_size + 1 );
1707
1713
for (Py_ssize_t i = 0 ; i < old_size; i++) {
1708
- PyTuple_SetItem (module_names, i, PyTuple_GetItem (old_module_names, i));
1714
+ PyObject* val = PyTuple_GetItem (old_module_names, i);
1715
+ Py_INCREF (val);
1716
+ PyTuple_SetItem (module_names, i, val);
1709
1717
}
1710
1718
PyTuple_SetItem (module_names, old_size, PyString_FromString (name.constData ()));
1711
1719
PyModule_AddObject (sys.object (), " builtin_module_names" , module_names);
1712
1720
}
1713
1721
Py_XDECREF (old_module_names);
1714
-
1715
- #ifdef PY3K
1716
- PyDict_SetItem (PyObject_GetAttrString (sys.object (), " modules" ), PyUnicode_FromString (name.constData ()), _p->_pythonQtModule .object ());
1717
- #endif
1718
1722
}
1719
1723
1720
1724
QString PythonQt::getReturnTypeOfWrappedMethod (PyObject* module, const QString& name)
0 commit comments