Ejemplo n.º 1
0
// Return the value of the reply.  The GIL should be held.
PyObject *QPyDBusReply::value(PyObject *type) const
{
    if (!_q_is_valid)
    {
        PyErr_SetString(PyExc_ValueError, "QDBusReply value is invalid");
        return 0;
    }

    // Return any explicit value.
    if (_q_value)
    {
        if (type)
        {
            PyErr_SetString(PyExc_ValueError,
                    "'type' argument cannot be used with an explcitly typed reply");
            return 0;
        }

        Py_INCREF(_q_value);
        return _q_value;
    }

    QVariant val(_q_value_variant);

    return qpycore_qvariant_value(val, type);
}
// Return the value of the reply.  The GIL should be held.
PyObject *QPyDBusPendingReply::value(PyObject *type) const
{
    QVariant val;

    // This will wait for the call to complete.
    Py_BEGIN_ALLOW_THREADS
    val = argumentAt(0);
    Py_END_ALLOW_THREADS

    return qpycore_qvariant_value(val, type);
}