pygobject3/gdk-atom-2.patch
2012-11-26 10:14:06 -06:00

39 lines
1.0 KiB
Diff

From 0e7aec1bc5555b05b67da63176312eb51460b9ee Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinpitt@gnome.org>
Date: Tue, 13 Nov 2012 16:38:36 +0100
Subject: [PATCH 2/3] Fix Gdk.Atom str()/repr() fallback
Fix regression in commit 6713618: If an atom does not have a name, do not
recursively call our own str()/repr() methods, but just print
"Gdk.Atom<atom_id>".
---
gi/overrides/Gdk.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index 0571c40..63f1467 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -352,14 +352,16 @@ def _gdk_atom_str(atom):
n = atom.name()
if n:
return n
- return Gdk.Atom.__str__(n)
+ # fall back to atom index
+ return 'Gdk.Atom<%i>' % hash(atom)
def _gdk_atom_repr(atom):
n = atom.name()
if n:
return 'Gdk.Atom<%s>' % n
- return Gdk.Atom.__str__(n)
+ # fall back to atom index
+ return 'Gdk.Atom<%i>' % hash(atom)
Gdk.Atom.__str__ = _gdk_atom_str
--
1.7.11.7