PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 1125 - Shiboken fail to generate bindings for pure virtual functions returning a reference.
: Shiboken fail to generate bindings for pure virtual functions returning a ref...
Status: NEW
Product: PySide
Classification: Unclassified
Component: Shiboken
: HEAD
: Other Linux
: P3 normal
Assigned To: Marcelo Lira
:
:
:
  Show dependency treegraph
 
Reported: 2012-01-19 19:15 EET by Hugo Parente Lima
Modified: 2012-03-08 16:57 EET (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Parente Lima 2012-01-19 19:15:05 EET
C++ code:

#include <QtCore/QString>

class Test
{
public:
    virtual const QString& getName() const = 0;

    virtual ~Test();
};

Generated code:

const QString & TestWrapper::getName() const
{
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return ::QString();
    Shiboken::AutoDecRef
pyOverride(Shiboken::BindingManager::instance().getOverride(this, "getName"));
    if (pyOverride.isNull()) {
        PyErr_SetString(PyExc_NotImplementedError, "pure virtual method
'Test.getName()' not implemented.");
        return ::QString();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, NULL));
    // An error happened in python code!
    if (pyResult.isNull()) {
        PyErr_Print();
        return ::QString();
    }
    // Check return type
    PythonToCppFunc pythonToCpp =
Shiboken::Conversions::isPythonToCppConvertible(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX],
pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2, "Invalid return value in
function %s, expected %s, got %s.", "Test.getName", "QString",
pyResult->ob_type->tp_name);
        return ::QString();
    }
    ::QString cppResult = ::QString();
    pythonToCpp(pyResult, &cppResult);
    return *cppResult;
}

It tries to dereference cppResult, but cppResult isn't a pointer.
Comment 1 Matti Airas 2012-03-08 16:57:53 EET
PySide is now a Qt-addon and uses Qt Project's JIRA tool for tracking bugs.
Please verify that the bug is still valid and re-submit it in the address
below:

https://bugreports.qt-project.org/

Sorry for the inconvenience!