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>
This commit is contained in:
parent
4985f114a3
commit
e2524f6abb
2 changed files with 47 additions and 1 deletions
|
|
@ -9,7 +9,14 @@ struct Converter<HWND>
|
||||||
|
|
||||||
static bool isConvertible(PyObject* pyobj)
|
static bool isConvertible(PyObject* pyobj)
|
||||||
{
|
{
|
||||||
|
if (pyobj == Py_None)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
#ifdef IS_PY3K
|
||||||
|
return PyCapsule_CheckExact(pyobj);
|
||||||
|
#else
|
||||||
return PyCObject_Check(pyobj);
|
return PyCObject_Check(pyobj);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline PyObject* toPython(void* cppobj)
|
static inline PyObject* toPython(void* cppobj)
|
||||||
|
|
@ -21,12 +28,27 @@ struct Converter<HWND>
|
||||||
|
|
||||||
static PyObject* toPython(HWND cppobj)
|
static PyObject* toPython(HWND cppobj)
|
||||||
{
|
{
|
||||||
|
if (!cppobj)
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
|
#ifdef IS_PY3K
|
||||||
|
return PyCapsule_New(cppobj, 0, 0);
|
||||||
|
#else
|
||||||
return PyCObject_FromVoidPtr(cppobj, 0);
|
return PyCObject_FromVoidPtr(cppobj, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND toCpp(PyObject* pyobj)
|
static HWND toCpp(PyObject* pyobj)
|
||||||
{
|
{
|
||||||
|
if (pyobj == Py_None)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#ifdef IS_PY3K
|
||||||
|
return (HWND)PyCapsule_GetPointer(pyobj, 0);
|
||||||
|
#else
|
||||||
return (HWND)PyCObject_AsVoidPtr(pyobj);
|
return (HWND)PyCObject_AsVoidPtr(pyobj);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
|
|
||||||
namespace Shiboken {
|
namespace Shiboken {
|
||||||
template <>
|
template <>
|
||||||
struct Converter<WId>
|
struct Converter<WId>
|
||||||
|
|
@ -10,7 +11,14 @@ struct Converter<WId>
|
||||||
|
|
||||||
static bool isConvertible(PyObject* pyobj)
|
static bool isConvertible(PyObject* pyobj)
|
||||||
{
|
{
|
||||||
|
if (pyobj == Py_None)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
#ifdef IS_PY3K
|
||||||
|
return PyCapsule_CheckExact(pyobj);
|
||||||
|
#else
|
||||||
return PyCObject_Check(pyobj);
|
return PyCObject_Check(pyobj);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline PyObject* toPython(void* cppobj)
|
static inline PyObject* toPython(void* cppobj)
|
||||||
|
|
@ -22,13 +30,29 @@ struct Converter<WId>
|
||||||
|
|
||||||
static PyObject* toPython(WId cppobj)
|
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);
|
return PyCObject_FromVoidPtr(cppobj, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static WId toCpp(PyObject* pyobj)
|
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
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue