diff options
author | Paulo Alcantara <pcacjr@gmail.com> | 2011-12-01 13:32:18 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:56:17 -0300 |
commit | e2524f6abb6c00695edce5be26a7d6fc7b71c5fe (patch) | |
tree | 639baf7e393e1b697d28cc992fe316552e5b149f /PySide/QtGui | |
parent | 4985f114a30d5ce0de2a5402d3f2be3d97a93dc4 (diff) |
Fix BUG #1034 - "Error compiling PySide with Python 3.2.2 32bit on Windows"
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'PySide/QtGui')
-rw-r--r-- | PySide/QtGui/glue/wid_conversions.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/PySide/QtGui/glue/wid_conversions.h b/PySide/QtGui/glue/wid_conversions.h index 1abb5f288..183e682fe 100644 --- a/PySide/QtGui/glue/wid_conversions.h +++ b/PySide/QtGui/glue/wid_conversions.h @@ -1,4 +1,5 @@ #ifndef Q_WS_WIN + namespace Shiboken { template <> struct Converter<WId> @@ -10,7 +11,14 @@ 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 } static inline PyObject* toPython(void* cppobj) @@ -22,13 +30,29 @@ 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 } static WId toCpp(PyObject* pyobj) { - return (WId) PyCObject_AsVoidPtr(pyobj); + if (pyobj == Py_None) + return 0; + +#ifdef IS_PY3K + return (WId)PyCapsule_GetPointer(pyobj, 0); +#else + return (WId)PyCObject_AsVoidPtr(pyobj); +#endif } }; + } + #endif |