diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-06-20 14:10:36 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-06-24 16:30:34 +0100 |
commit | a0a2044e3431cd16c1804d33bacaf414e62396a2 (patch) | |
tree | eb2345ccbcc32c4abbb4587c43c61e3139aa2d6b | |
parent | 9f580dbb64839281c74cb68b6872370d0756af20 (diff) |
cli/pickle: Pass across tuples/lists consistently.
-rw-r--r-- | cli/cli_pickle.cpp | 4 | ||||
-rwxr-xr-x | scripts/unpickle.py | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/cli/cli_pickle.cpp b/cli/cli_pickle.cpp index 6d368028..04aec1b2 100644 --- a/cli/cli_pickle.cpp +++ b/cli/cli_pickle.cpp @@ -98,7 +98,7 @@ public: if (symbolic) { unsigned long long value = node->value; const BitmaskSig *sig = node->sig; - writer.beginList(); + writer.beginTuple(); for (const BitmaskFlag *it = sig->flags; it != sig->flags + sig->num_flags; ++it) { if ((it->value && (value & it->value) == it->value) || (!it->value && value == 0)) { @@ -112,7 +112,7 @@ public: if (value) { writer.writeInt(value); } - writer.endList(); + writer.endTuple(); } else { writer.writeInt(node->value); } diff --git a/scripts/unpickle.py b/scripts/unpickle.py index a561bf69..0249e4b7 100755 --- a/scripts/unpickle.py +++ b/scripts/unpickle.py @@ -125,10 +125,12 @@ class Dumper(Visitor): return repr(obj) def visitTuple(self, obj): - return '[' + ', '.join(itertools.imap(self.visit, obj)) + ']' + return '(' + ', '.join(itertools.imap(self.visit, obj)) + ')' def visitList(self, obj): - return '(' + ', '.join(itertools.imap(self.visit, obj)) + ')' + if len(obj) == 1: + return '&' + self.visit(obj[0]) + return '{' + ', '.join(itertools.imap(self.visit, obj)) + '}' def visitByteArray(self, obj): return 'blob(%u)' % len(obj) |