Commit 24cc09a7 authored by Steve Frécinaux's avatar Steve Frécinaux Committed by Martin Pitt
Browse files

Do not bind gobject_get_data() and gobject_set_data()

They will basically cause a crash if misused, and you can always use a
python member attribute instead.

https://bugzilla.gnome.org/show_bug.cgi?id=641944

Signed-off-by: default avatarMartin Pitt <martinpitt@gnome.org>
parent 2a5a33a9
......@@ -1416,44 +1416,6 @@ pygobject_thaw_notify(PyGObject *self, PyObject *args)
return Py_None;
}
static PyObject *
pygobject_get_data(PyGObject *self, PyObject *args)
{
char *key;
GQuark quark;
PyObject *data;
if (!PyArg_ParseTuple(args, "s:GObject.get_data", &key))
return NULL;
CHECK_GOBJECT(self);
quark = g_quark_from_string(key);
data = g_object_get_qdata(self->obj, quark);
if (!data) data = Py_None;
Py_INCREF(data);
return data;
}
static PyObject *
pygobject_set_data(PyGObject *self, PyObject *args)
{
char *key;
GQuark quark;
PyObject *data;
if (!PyArg_ParseTuple(args, "sO:GObject.set_data", &key, &data))
return NULL;
CHECK_GOBJECT(self);
quark = g_quark_from_string(key);
Py_INCREF(data);
g_object_set_qdata_full(self->obj, quark, data, pyg_destroy_notify);
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
pygobject_connect(PyGObject *self, PyObject *args)
{
......@@ -2056,8 +2018,6 @@ static PyMethodDef pygobject_methods[] = {
{ "freeze_notify", (PyCFunction)pygobject_freeze_notify, METH_VARARGS },
{ "notify", (PyCFunction)pygobject_notify, METH_VARARGS },
{ "thaw_notify", (PyCFunction)pygobject_thaw_notify, METH_VARARGS },
{ "get_data", (PyCFunction)pygobject_get_data, METH_VARARGS },
{ "set_data", (PyCFunction)pygobject_set_data, METH_VARARGS },
{ "connect", (PyCFunction)pygobject_connect, METH_VARARGS },
{ "connect_after", (PyCFunction)pygobject_connect_after, METH_VARARGS },
{ "connect_object", (PyCFunction)pygobject_connect_object, METH_VARARGS },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment