From cf59ae09fba743058f8139338e98b3db85ea63e8 Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Tue, 16 Aug 2016 00:15:36 -0400 Subject: [PATCH] Fix TopicTreeTraverser when doing breadth traversal on Python 3 Python 3 orders maps differently from Python 2, so sort the subtopics before traversing them like is done with depth traversal. --- wx/lib/pubsub/core/topictreetraverser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wx/lib/pubsub/core/topictreetraverser.py b/wx/lib/pubsub/core/topictreetraverser.py index e31732f0..fac6d69c 100644 --- a/wx/lib/pubsub/core/topictreetraverser.py +++ b/wx/lib/pubsub/core/topictreetraverser.py @@ -55,6 +55,8 @@ class TopicTreeTraverser: def extendQueue(subtopics): topics.append(visitor._startChildren) + # put subtopics in list in alphabetical order + subtopics.sort(key=topicObj.__class__.getName) topics.extend(subtopics) topics.append(visitor._endChildren)