[pygobject] Remove pyg_type_name() and use GType.name instead
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Remove pyg_type_name() and use GType.name instead
- Date: Thu, 22 Mar 2018 07:04:50 +0000 (UTC)
commit 3d94a95eb49a6b9b0c2ab0121a0bed4eb69042bb
Author: Christoph Reiter <reiter christoph gmail com>
Date: Wed Mar 21 10:54:46 2018 +0100
Remove pyg_type_name() and use GType.name instead
gi/_propertyhelper.py | 2 +-
gi/gimodule.c | 1 -
gi/gobjectmodule.c | 25 -------------------------
gi/gobjectmodule.h | 1 -
tests/test_properties.py | 4 ++++
5 files changed, 5 insertions(+), 28 deletions(-)
---
diff --git a/gi/_propertyhelper.py b/gi/_propertyhelper.py
index 3fd531b5..8690b8a0 100644
--- a/gi/_propertyhelper.py
+++ b/gi/_propertyhelper.py
@@ -210,7 +210,7 @@ class Property(object):
def __repr__(self):
return '<GObject Property %s (%s)>' % (
self.name or '(uninitialized)',
- _gi.type_name(self.type))
+ self.type.name)
def __get__(self, instance, klass):
if instance is None:
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 013a2101..4bcb5fb9 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -641,7 +641,6 @@ static PyMethodDef _gi_functions[] = {
"\n"
"Execute a child program asynchronously within a glib.MainLoop()\n"
"See the reference manual for a complete reference.\n" },
- { "type_name", pyg_type_name, METH_VARARGS },
{ "type_register", _wrap_pyg_type_register, METH_VARARGS },
{ "signal_new", pyg_signal_new, METH_VARARGS },
{ "list_properties",
diff --git a/gi/gobjectmodule.c b/gi/gobjectmodule.c
index 63c2645c..3b2be53a 100644
--- a/gi/gobjectmodule.c
+++ b/gi/gobjectmodule.c
@@ -88,31 +88,6 @@ pyg_destroy_notify(gpointer user_data)
/* ---------------- gobject module functions -------------------- */
-PyObject *
-pyg_type_name (PyObject *self, PyObject *args)
-{
- PyObject *gtype;
- GType type;
- const gchar *name;
-
-#if 0
- if (PyErr_Warn(PyExc_DeprecationWarning,
- "gobject.type_name is deprecated; "
- "use GType.name instead"))
- return NULL;
-#endif
-
- if (!PyArg_ParseTuple(args, "O:gobject.type_name", >ype))
- return NULL;
- if ((type = pyg_type_from_object(gtype)) == 0)
- return NULL;
- name = g_type_name(type);
- if (name)
- return PYGLIB_PyUnicode_FromString(name);
- PyErr_SetString(PyExc_RuntimeError, "unknown typecode");
- return NULL;
-}
-
static void
pyg_object_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
diff --git a/gi/gobjectmodule.h b/gi/gobjectmodule.h
index 873a1592..5cc927a1 100644
--- a/gi/gobjectmodule.h
+++ b/gi/gobjectmodule.h
@@ -13,7 +13,6 @@ void pygobject_register_constants (PyObject *m);
void pygobject_register_version_tuples (PyObject *d);
void pygobject_register_warnings (PyObject *d);
-PyObject * pyg_type_name (PyObject *self, PyObject *args);
PyObject * _wrap_pyg_type_register (PyObject *self, PyObject *args);
PyObject * pyg_signal_new (PyObject *self, PyObject *args);
PyObject * pyg_object_class_list_properties (PyObject *self, PyObject *args);
diff --git a/tests/test_properties.py b/tests/test_properties.py
index 622fdb22..a2ff03ce 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -255,6 +255,10 @@ class TestPropertyObject(unittest.TestCase):
self.assertRaises(TypeError, GObject.Property, type=Gio.SocketType,
default=1)
+ def test_repr(self):
+ prop = GObject.Property(type=int)
+ assert repr(prop) == "<GObject Property (uninitialized) (gint)>"
+
def test_flags(self):
obj = new(PropertyObject)
self.assertEqual(obj.props.flags, GIMarshallingTests.Flags.VALUE1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]