diff options
Diffstat (limited to 'PySide')
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 10 | ||||
-rw-r--r-- | PySide/typesystem_templates.xml | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 20946454a..8795cf5f8 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -985,10 +985,7 @@ <value-type name="QPersistentModelIndex"> <modify-function signature="internalPointer()const"> <inject-code class="target" position="beginning"> - %PYARG_0 = (PyObject*)%CPPSELF.%FUNCTION_NAME(); - if (!%PYARG_0) - %PYARG_0 = Py_None; - Py_XINCREF(%PYARG_0); + <insert-template name="return_internal_pointer" /> </inject-code> </modify-function> <modify-function signature="operator const QModelIndex&()const"> @@ -2825,10 +2822,7 @@ <value-type name="QModelIndex"> <modify-function signature="internalPointer()const"> <inject-code class="target" position="beginning"> - %PYARG_0 = (PyObject*)%CPPSELF.%FUNCTION_NAME(); - if (!%PYARG_0) - %PYARG_0 = Py_None; - Py_XINCREF(%PYARG_0); + <insert-template name="return_internal_pointer" /> </inject-code> </modify-function> <modify-function signature="model()const"> diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 8a2628148..3a46c620f 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -272,6 +272,12 @@ %PYARG_0 = PyString_FromString(qPrintable(format)); </template> + <template name="return_internal_pointer"> + %PYARG_0 = reinterpret_cast<PyObject*>(%CPPSELF.%FUNCTION_NAME()); + if (!%PYARG_0) + %PYARG_0 = Py_None; + Py_INCREF(%PYARG_0); + </template> <!-- templates for __reduce__ --> <template name="reduce_code"> |