fix compile with python 3.3.x - closes #1595
This commit is contained in:
parent
5440594e0c
commit
6128097d78
2 changed files with 9 additions and 0 deletions
|
@ -382,7 +382,11 @@ bool has_cairo()
|
||||||
bool has_pycairo()
|
bool has_pycairo()
|
||||||
{
|
{
|
||||||
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
||||||
|
#if PY_MAJOR_VERSION >= 3
|
||||||
|
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCapsule_Import(const_cast<char *>("cairo.CAPI"), 0);
|
||||||
|
#else
|
||||||
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast<char *>("cairo"), const_cast<char *>("CAPI"));
|
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast<char *>("cairo"), const_cast<char *>("CAPI"));
|
||||||
|
#endif
|
||||||
if (Pycairo_CAPI == NULL){
|
if (Pycairo_CAPI == NULL){
|
||||||
/*
|
/*
|
||||||
Case where pycairo support has been compiled into
|
Case where pycairo support has been compiled into
|
||||||
|
|
|
@ -31,6 +31,7 @@ static Pycairo_CAPI_t *Pycairo_CAPI;
|
||||||
|
|
||||||
static void *extract_surface(PyObject* op)
|
static void *extract_surface(PyObject* op)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (PyObject_TypeCheck(op, const_cast<PyTypeObject*>(Pycairo_CAPI->Surface_Type)))
|
if (PyObject_TypeCheck(op, const_cast<PyTypeObject*>(Pycairo_CAPI->Surface_Type)))
|
||||||
{
|
{
|
||||||
return op;
|
return op;
|
||||||
|
@ -55,7 +56,11 @@ static void *extract_context(PyObject* op)
|
||||||
|
|
||||||
void register_cairo()
|
void register_cairo()
|
||||||
{
|
{
|
||||||
|
#if PY_MAJOR_VERSION >= 3
|
||||||
|
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCapsule_Import(const_cast<char *>("cairo.CAPI"), 0);
|
||||||
|
#else
|
||||||
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast<char *>("cairo"), const_cast<char *>("CAPI"));
|
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast<char *>("cairo"), const_cast<char *>("CAPI"));
|
||||||
|
#endif
|
||||||
if (Pycairo_CAPI == NULL) return;
|
if (Pycairo_CAPI == NULL) return;
|
||||||
|
|
||||||
boost::python::converter::registry::insert(&extract_surface, boost::python::type_id<PycairoSurface>());
|
boost::python::converter::registry::insert(&extract_surface, boost::python::type_id<PycairoSurface>());
|
||||||
|
|
Loading…
Reference in a new issue