[pygobject/pygobject-2-28] Fix flags with multiple names for the same value.



commit 992c0c1096c77bc299a40a34ec30a2ac0c562ed4
Author: Laszlo Pandy <lpandy src gnome org>
Date:   Wed Feb 23 11:40:55 2011 +0100

    Fix flags with multiple names for the same value.
    
    Flags constructs a dict __flags_values__ and uses it to cache
    instances. However some flags in Glib such as G_IO_FLAG_MASK and
    G_IO_FLAG_GET_MASK are aliases for the same int value, and will
    override each other's place in the dictionary.
    
    The dict length check is not necessary. It only reduces the number
    of duplicate instances we keep, because if an instance is not
    found in the dict, a new one is created anyway.

 gobject/pygflags.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gobject/pygflags.c b/gobject/pygflags.c
index ce99a86..8c00f15 100644
--- a/gobject/pygflags.c
+++ b/gobject/pygflags.c
@@ -161,7 +161,7 @@ pyg_flags_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 	return NULL;
     }
 
-    if (!PyDict_Check(values) || PyDict_Size(values) != eclass->n_values) {
+    if (!PyDict_Check(values)) {
 	PyErr_SetString(PyExc_TypeError, "__flags_values__ badly formed");
 	Py_DECREF(values);
 	g_type_class_unref(eclass);



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