aboutsummaryrefslogtreecommitdiff
path: root/test/gen-threads.py
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2014-10-31 13:33:25 -0400
committerDavid Bremner <david@tethera.net>2014-11-02 19:43:39 +0100
commit0d40b3795413b9d7d930caa1eb3b700c88fe2614 (patch)
tree7f79777f07092f09613ef6d3214a7fd70fd3895c /test/gen-threads.py
parent207f3bf82102f01fbbda193018e81a82f6c1259d (diff)
test: Make gen-threads work with python3
python3 doesn't allow dictionaries to be initialized with non-string keywords. This presents problems on systems in which "python" means "python3". We instead initalize the dictionary using the dict comprehension and then update it with the values from the tree. This will work with both python2 and python3.
Diffstat (limited to 'test/gen-threads.py')
-rw-r--r--test/gen-threads.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/gen-threads.py b/test/gen-threads.py
index 9fbb8474..70fb1f68 100644
--- a/test/gen-threads.py
+++ b/test/gen-threads.py
@@ -2,7 +2,6 @@
# argv[1]. Each output line is a thread structure, where the n'th
# field is either a number giving the parent of message n or "None"
# for the root.
-
import sys
from itertools import chain, combinations
@@ -28,6 +27,7 @@ while queue:
else:
# Expand node to_expand[0] with each possible set of children
for children in subsets(free):
- ntree = dict(tree, **{child: to_expand[0] for child in children})
+ ntree = {child: to_expand[0] for child in children}
+ ntree.update(tree)
nfree = free.difference(children)
queue.append((ntree, nfree, to_expand[1:] + tuple(children)))