[pygobject] [API change] Do not bind gobject_get_data() and gobject_set_data()



commit 7635340271df0a135873459e6a2a365fd4b187a2
Author: Steve FrÃcinaux <code istique net>
Date:   Wed Feb 9 18:37:33 2011 +0100

    [API change] 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.
    
    These methods were marked as deprecated for 3.4 and throwing a warning, so
    let's remove them for good now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641944
    
    Co-Authored-By: Martin Pitt <martinpitt gnome org>

 docs/reference/pygobject.xml |   63 ------------------------------------------
 gi/_gobject/pygobject.c      |   44 -----------------------------
 2 files changed, 0 insertions(+), 107 deletions(-)
---
diff --git a/docs/reference/pygobject.xml b/docs/reference/pygobject.xml
index 42cd37b..2021c48 100644
--- a/docs/reference/pygobject.xml
+++ b/docs/reference/pygobject.xml
@@ -57,17 +57,6 @@ linkend="method-gobject--thaw-notify">thaw_notify</link></methodname>
 	  <methodparam></methodparam>  </methodsynopsis>
 	<methodsynopsis language="python">
 	  <methodname><link
-linkend="method-gobject--get-data">get_data</link></methodname>
-	  <methodparam><parameter>key</parameter></methodparam>
-	</methodsynopsis>
-	<methodsynopsis language="python">
-	  <methodname><link
-linkend="method-gobject--set-data">set_data</link></methodname>
-	  <methodparam><parameter>key</parameter></methodparam>
-	  <methodparam><parameter>data</parameter></methodparam>
-	</methodsynopsis>
-	<methodsynopsis language="python">
-	  <methodname><link
 linkend="method-gobject--connect">connect</link></methodname>
 	  <methodparam><parameter>detailed_signal</parameter></methodparam>
 	  <methodparam><parameter>handler</parameter></methodparam>
@@ -435,58 +424,6 @@ emitted.</para>
 
     </refsect2>
 
-    <refsect2 id="method-gobject--get-data">
-      <title>gobject.GObject.get_data</title>
-
-      <programlisting><methodsynopsis language="python">
-	  <methodname>get_data</methodname>
-	  <methodparam><parameter>key</parameter></methodparam>
-	</methodsynopsis></programlisting>
-      <variablelist>
-	<varlistentry>
-	  <term><parameter>key</parameter>&nbsp;:</term>
-	  <listitem><simpara>a string used as the key</simpara></listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
-	  <listitem><simpara>a Python object containing the associated
-data</simpara></listitem>
-	</varlistentry>
-      </variablelist>
-
-      <para>The <methodname>get_data</methodname>() method returns the
-Python object associated with the specified <parameter>key</parameter> or
-None if there is no data associated with the <parameter>key</parameter> or
-if there is no key associated with the object.</para>
-
-    </refsect2>
-
-    <refsect2 id="method-gobject--set-data">
-      <title>gobject.GObject.set_data</title>
-
-      <programlisting><methodsynopsis language="python">
-	  <methodname>set_data</methodname>
-	  <methodparam><parameter>key</parameter></methodparam>
-	  <methodparam><parameter>data</parameter></methodparam>
-	</methodsynopsis></programlisting>
-      <variablelist>
-	<varlistentry>
-	  <term><parameter>key</parameter>&nbsp;:</term>
-	  <listitem><simpara>a string used as a key</simpara></listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term><parameter>data</parameter>&nbsp;:</term>
-	  <listitem><simpara>a Python object that is the value to be
-associated with the key</simpara></listitem>
-	</varlistentry>
-      </variablelist>
-
-      <para>The <methodname>set_data</methodname>() method associates the
-specified Python object (<parameter>data</parameter>) with
-<parameter>key</parameter>.</para>
-
-    </refsect2>
-
     <refsect2 id="method-gobject--connect">
       <title>gobject.GObject.connect</title>
 
diff --git a/gi/_gobject/pygobject.c b/gi/_gobject/pygobject.c
index 153a3c7..6dfffef 100644
--- a/gi/_gobject/pygobject.c
+++ b/gi/_gobject/pygobject.c
@@ -1707,48 +1707,6 @@ pygobject_thaw_notify(PyGObject *self, PyObject *args)
 }
 
 static PyObject *
-pygobject_get_data(PyGObject *self, PyObject *args)
-{
-    char *key;
-    GQuark quark;
-    PyObject *data;
-
-    g_warning("GObject.get_data() and set_data() are deprecated. Use normal Python attributes instead");
-
-    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;
-
-    g_warning("GObject.get_data() and set_data() are deprecated. Use normal Python attributes instead");
-
-    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)
 {
     PyObject *first, *callback, *extra_args, *repr = NULL;
@@ -2370,8 +2328,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 },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]