From 8ffaf045f7b38b69fb4a9eaacea6b37383acd053 Mon Sep 17 00:00:00 2001 From: Mazhar Hussain Date: Tue, 21 Feb 2023 21:23:00 +0500 Subject: Allow Gdk.{Color,RGBA} instances to be compared with other objects For example, `Gdk.RGBA() == None` should return False instead of raising a TypeError Fixes https://gitlab.gnome.org/GNOME/pygobject/-/issues/414 --- gi/overrides/Gdk.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py index 55a6c58c..49b1bc0a 100644 --- a/gi/overrides/Gdk.py +++ b/gi/overrides/Gdk.py @@ -53,6 +53,8 @@ if GDK2 or GDK3: self.blue = blue def __eq__(self, other): + if not isinstance(other, Gdk.Color): + return False return self.equal(other) def __repr__(self): @@ -94,6 +96,8 @@ if GDK3: self.alpha = alpha def __eq__(self, other): + if not isinstance(other, Gdk.RGBA): + return False return self.equal(other) def __repr__(self): -- cgit v1.2.1