diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-09-17 22:39:07 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-17 22:39:07 -0700 |
commit | 78e267e9c476a4befc332559d09f5b68f411b771 (patch) | |
tree | 2b2062c6e6a5bd67be057a6d56e39a60ec53fa51 | |
parent | 255af602e7c5f74460104fbfaa80c09a31b44a36 (diff) | |
download | portage-78e267e9c476a4befc332559d09f5b68f411b771.tar.gz portage-78e267e9c476a4befc332559d09f5b68f411b771.tar.bz2 portage-78e267e9c476a4befc332559d09f5b68f411b771.zip |
Use _unicode_decode() to force unicode format strings inside
digraph.debug_print().
-rw-r--r-- | pym/portage/util/digraph.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py index 2849b8e2c..df024fb4b 100644 --- a/pym/portage/util/digraph.py +++ b/pym/portage/util/digraph.py @@ -4,6 +4,7 @@ __all__ = ['digraph'] from collections import deque +from portage import _unicode_decode from portage.util import writemsg class digraph(object): @@ -266,14 +267,18 @@ class digraph(object): def debug_print(self): def output(s): writemsg(s, noiselevel=-1) + # Use _unicode_decode() to force unicode format + # strings for python-2.x safety, ensuring that + # node.__unicode__() is used when necessary. for node in self.nodes: - output("%s " % (node,)) + output(_unicode_decode("%s ") % (node,)) if self.nodes[node][0]: output("depends on\n") else: output("(no children)\n") for child, priorities in self.nodes[node][0].items(): - output(" %s (%s)\n" % (child, priorities[-1],)) + output(_unicode_decode(" %s (%s)\n") % \ + (child, priorities[-1],)) def bfs(self, start, ignore_priority=None): if start not in self: |