aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui/glue/wid_conversions.h
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-12-09 11:21:38 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:56:17 -0300
commit93bb5d777e6db0ba8d2b216832bf4211476c581e (patch)
tree24bc0e6fd68b48e5f4bdd609474def71313a7699 /PySide/QtGui/glue/wid_conversions.h
parente3814f27dd3975b5be5a2f328353fe7d144ce23b (diff)
Fix bug 1083 - "winId returns a PyCObject making it impossible to compare two winIds"
Diffstat (limited to 'PySide/QtGui/glue/wid_conversions.h')
-rw-r--r--PySide/QtGui/glue/wid_conversions.h25
1 files changed, 3 insertions, 22 deletions
diff --git a/PySide/QtGui/glue/wid_conversions.h b/PySide/QtGui/glue/wid_conversions.h
index 183e682fe..68d752884 100644
--- a/PySide/QtGui/glue/wid_conversions.h
+++ b/PySide/QtGui/glue/wid_conversions.h
@@ -11,14 +11,7 @@ struct Converter<WId>
static bool isConvertible(PyObject* pyobj)
{
- if (pyobj == Py_None)
- return true;
-
-#ifdef IS_PY3K
- return PyCapsule_CheckExact(pyobj);
-#else
- return PyCObject_Check(pyobj);
-#endif
+ return pyobj == Py_None || PyNumber_Check(pyobj);
}
static inline PyObject* toPython(void* cppobj)
@@ -30,26 +23,14 @@ struct Converter<WId>
static PyObject* toPython(WId cppobj)
{
- if (!cppobj)
- Py_RETURN_NONE;
-
-#ifdef IS_PY3K
- return PyCapsule_New(cppobj, 0, 0);
-#else
- return PyCObject_FromVoidPtr(cppobj, 0);
-#endif
+ return PyLong_FromVoidPtr((void*)cppobj);
}
static WId toCpp(PyObject* pyobj)
{
if (pyobj == Py_None)
return 0;
-
-#ifdef IS_PY3K
- return (WId)PyCapsule_GetPointer(pyobj, 0);
-#else
- return (WId)PyCObject_AsVoidPtr(pyobj);
-#endif
+ return (WId)PyLong_AsVoidPtr(pyobj);
}
};