diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-18 11:43:25 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-18 11:43:25 +0200 |
commit | 9db0321d31f9add44dd916db39bb642d028905e6 (patch) | |
tree | ee40a11a09e30db31a13c23632936d4e25bd1b7b | |
parent | 5b36db7cc8b702e969e6653ae1793ce13f1f38cc (diff) | |
download | pygobject-9db0321d31f9add44dd916db39bb642d028905e6.tar.gz |
Remove the PYGLIB_CPointer_ macros
They are simple aliases to the PyCapsule API, so just remove them.
-rw-r--r-- | gi/gimodule.c | 4 | ||||
-rw-r--r-- | gi/pygi-basictype.c | 4 | ||||
-rw-r--r-- | gi/pygi-python-compat.h | 8 | ||||
-rw-r--r-- | gi/pygi-value.c | 10 | ||||
-rw-r--r-- | gi/pygobject-object.c | 2 | ||||
-rw-r--r-- | gi/pygoptioncontext.c | 2 |
6 files changed, 11 insertions, 19 deletions
diff --git a/gi/gimodule.c b/gi/gimodule.c index 8e5d7225..fb436272 100644 --- a/gi/gimodule.c +++ b/gi/gimodule.c @@ -2380,7 +2380,7 @@ pygi_register_api(PyObject *d) { PyObject *api; - api = PYGLIB_CPointer_WrapPointer(&pygobject_api_functions, "gobject._PyGObject_API"); + api = PyCapsule_New (&pygobject_api_functions, "gobject._PyGObject_API", NULL); if (api == NULL) return -1; PyDict_SetItemString(d, "_PyGObject_API", api); @@ -2533,7 +2533,7 @@ PYGLIB_MODULE_START(_gi, "_gi") Py_INCREF(PyGIDeprecationWarning); PyModule_AddObject(module, "PyGIDeprecationWarning", PyGIDeprecationWarning); - api = PYGLIB_CPointer_WrapPointer ( (void *) &CAPI, "gi._API"); + api = PyCapsule_New ( (void *) &CAPI, "gi._API", NULL); if (api == NULL) { return PYGLIB_MODULE_ERROR_RETURN; } diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c index dad79c50..d5ce8169 100644 --- a/gi/pygi-basictype.c +++ b/gi/pygi-basictype.c @@ -47,8 +47,8 @@ pygi_gpointer_from_py (PyObject *py_arg, gpointer *result) if (py_arg == Py_None) { *result = NULL; return TRUE; - } else if (PYGLIB_CPointer_Check(py_arg)) { - temp = PYGLIB_CPointer_GetPointer (py_arg, NULL); + } else if (PyCapsule_CheckExact (py_arg)) { + temp = PyCapsule_GetPointer (py_arg, NULL); if (temp == NULL) return FALSE; *result = temp; diff --git a/gi/pygi-python-compat.h b/gi/pygi-python-compat.h index 78c6660f..23fd9738 100644 --- a/gi/pygi-python-compat.h +++ b/gi/pygi-python-compat.h @@ -25,14 +25,6 @@ #include <Python.h> -# define PYGLIB_CPointer_Check PyCapsule_CheckExact -# define PYGLIB_CPointer_WrapPointer(ptr, typename) \ - PyCapsule_New(ptr, typename, NULL) -# define PYGLIB_CPointer_GetPointer(obj, typename) \ - PyCapsule_GetPointer(obj, typename) -# define PYGLIB_CPointer_Import(module, symbol) \ - PyCapsule_Import(##module##.##symbol##, FALSE) - #define PYGLIB_MODULE_ERROR_RETURN NULL #ifdef __GNUC__ diff --git a/gi/pygi-value.c b/gi/pygi-value.c index c4416fc5..c3b1da55 100644 --- a/gi/pygi-value.c +++ b/gi/pygi-value.c @@ -511,8 +511,8 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) else if (PyObject_TypeCheck(obj, &PyGPointer_Type) && G_VALUE_HOLDS(value, ((PyGPointer *)obj)->gtype)) g_value_set_pointer(value, pyg_pointer_get(obj, gpointer)); - else if (PYGLIB_CPointer_Check(obj)) - g_value_set_pointer(value, PYGLIB_CPointer_GetPointer(obj, NULL)); + else if (PyCapsule_CheckExact (obj)) + g_value_set_pointer(value, PyCapsule_GetPointer (obj, NULL)); else if (G_VALUE_HOLDS_GTYPE (value)) g_value_set_gtype (value, pyg_type_from_object (obj)); else { @@ -568,8 +568,8 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) } else if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) return bm->tovalue(value, obj); - else if (PYGLIB_CPointer_Check(obj)) - g_value_set_boxed(value, PYGLIB_CPointer_GetPointer(obj, NULL)); + else if (PyCapsule_CheckExact (obj)) + g_value_set_boxed(value, PyCapsule_GetPointer (obj, NULL)); else { PyErr_SetString(PyExc_TypeError, "Expected Boxed"); return -1; @@ -582,7 +582,7 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) if (G_IS_PARAM_SPEC (pygobject_get (obj))) g_value_set_param(value, G_PARAM_SPEC (pygobject_get (obj))); else if (pyg_param_spec_check (obj)) - g_value_set_param(value, PYGLIB_CPointer_GetPointer(obj, NULL)); + g_value_set_param(value, PyCapsule_GetPointer (obj, NULL)); else { PyErr_SetString(PyExc_TypeError, "Expected ParamSpec"); return -1; diff --git a/gi/pygobject-object.c b/gi/pygobject-object.c index d52c7ddc..31216c54 100644 --- a/gi/pygobject-object.c +++ b/gi/pygobject-object.c @@ -2209,7 +2209,7 @@ pygobject_get_refcount(PyGObject *self, void *closure) static PyObject * pygobject_get_pointer(PyGObject *self, void *closure) { - return PYGLIB_CPointer_WrapPointer (self->obj, NULL); + return PyCapsule_New (self->obj, NULL, NULL); } static int diff --git a/gi/pygoptioncontext.c b/gi/pygoptioncontext.c index d807e0a1..61ecb763 100644 --- a/gi/pygoptioncontext.c +++ b/gi/pygoptioncontext.c @@ -341,7 +341,7 @@ pyg_option_context_richcompare(PyObject *self, PyObject *other, int op) static PyObject * pyg_option_get_context(PyGOptionContext *self) { - return PYGLIB_CPointer_WrapPointer(self->context, "goption.context"); + return PyCapsule_New (self->context, "goption.context", NULL); } static PyMethodDef pyg_option_context_methods[] = { |