summaryrefslogtreecommitdiffstats
path: root/gobject
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2008-05-23 16:54:58 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-05-23 16:54:58 +0000
commita1c2bc60bd137b0faecb75a22f8c96c952c4ada4 (patch)
tree9c89705e7632e3579bbc68890da086a493f0e810 /gobject
parent4689542d67328249508d78bc463866cd2a20fe34 (diff)
Merge from trunk:
2008-05-23 Johan Dahlin <jdahlin@async.com.br> Merge from trunk: * gobject/__init__.py: * tests/test_properties.py: Allow gobject.property work with subclasses. Add tests. (#523352, Tomeu Vizoso) * gobject/pygsource.c: * tests/test_source.py: Unbreak Source.prepare (#523075, Bryan Silverthorn) * gobject/gobjectmodule.c (REGISTER_TYPE): Never override customly set 'tp_new' and 'tp_alloc'. * configure.ac: Don't link against libffi if we cannot find libffi on the system. (#496006, Ed Catmur) * Makefile.am: Dist .m4 files. (#496011, Ed Catmur) * gobject/pygenum.c (pyg_enum_richcompare): Don't return NULL after warning; more useful warning message (bug #519631). svn path=/branches/pygobject-2-14/; revision=781
Diffstat (limited to 'gobject')
-rw-r--r--gobject/__init__.py8
-rw-r--r--gobject/gobjectmodule.c6
-rw-r--r--gobject/pygenum.c7
-rw-r--r--gobject/pygsource.c4
4 files changed, 14 insertions, 11 deletions
diff --git a/gobject/__init__.py b/gobject/__init__.py
index c1404f9..488d87e 100644
--- a/gobject/__init__.py
+++ b/gobject/__init__.py
@@ -57,15 +57,16 @@ class GObjectMeta(type):
cls.__gproperties__ = gproperties
- if (hasattr(cls, 'do_get_property') or
- hasattr(cls, 'do_set_property')):
+ if ('do_get_property' in cls.__dict__ or
+ 'do_set_property' in cls.__dict__):
for prop in props:
if (prop.getter != prop._default_getter or
prop.setter != prop._default_setter):
raise TypeError(
"GObject subclass %r defines do_get/set_property"
" and it also uses a property which a custom setter"
- " or getter. This is not allowed" % (cls,))
+ " or getter. This is not allowed" % (
+ cls.__name__,))
def obj_get_property(self, pspec):
name = pspec.name.replace('-', '_')
@@ -92,7 +93,6 @@ class GObjectMeta(type):
return
type_register(cls, namespace.get('__gtype_name__'))
-
_gobject._install_metaclass(GObjectMeta)
del _gobject
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 4881120..9d30449 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -3506,8 +3506,10 @@ struct _PyGObject_Functions pygobject_api_functions = {
#define REGISTER_TYPE(d, type, name) \
type.ob_type = &PyType_Type; \
- type.tp_alloc = PyType_GenericAlloc; \
- type.tp_new = PyType_GenericNew; \
+ if (!type.tp_alloc) \
+ type.tp_alloc = PyType_GenericAlloc; \
+ if (!type.tp_new) \
+ type.tp_new = PyType_GenericNew; \
if (PyType_Ready(&type)) \
return; \
PyDict_SetItemString(d, name, (PyObject *)&type);
diff --git a/gobject/pygenum.c b/gobject/pygenum.c
index 543bc49..876e464 100644
--- a/gobject/pygenum.c
+++ b/gobject/pygenum.c
@@ -30,14 +30,17 @@
static PyObject *
pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op)
{
+ static char warning[256];
+
if (!PyInt_Check(other)) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
if (PyObject_TypeCheck(other, &PyGEnum_Type) && ((PyGEnum*)other)->gtype != self->gtype) {
- PyErr_Warn(PyExc_Warning, "comparing different enum types");
- return NULL;
+ g_snprintf(warning, sizeof(warning), "comparing different enum types: %s and %s",
+ g_type_name(self->gtype), g_type_name(((PyGEnum*)other)->gtype));
+ PyErr_Warn(PyExc_Warning, warning);
}
return pyg_integer_richcompare((PyObject *)self, other, op);
diff --git a/gobject/pygsource.c b/gobject/pygsource.c
index 900bd4f..9e831e5 100644
--- a/gobject/pygsource.c
+++ b/gobject/pygsource.c
@@ -418,14 +418,12 @@ pyg_source_prepare(GSource *source, gint *timeout)
}
ret = PyObject_IsTrue(PyTuple_GET_ITEM(t, 0));
-
- if (ret) {
*timeout = PyInt_AsLong(PyTuple_GET_ITEM(t, 1));
+
if (*timeout == -1 && PyErr_Occurred()) {
ret = FALSE;
goto bail;
}
- }
got_err = FALSE;