Nir Soffer has uploaded a new change for review.
Change subject: schema: Fix asserts that had side effect
......................................................................
schema: Fix asserts that had side effect
Asserts should never have side effects, so optimizing them out will not
change the semantics of the code. Running with optimization would break
parsing, eliminating line.pop(0) operations. Now the only difference is
the warning if the line is not empty.
Change-Id: I59dbb1c8d3760af7d3f3049227f6ad8ceeaa402a
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/rpc/process-schema.py
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/34362/1
diff --git a/vdsm/rpc/process-schema.py b/vdsm/rpc/process-schema.py
index 4b1c3cf..8e56a1a 100755
--- a/vdsm/rpc/process-schema.py
+++ b/vdsm/rpc/process-schema.py
@@ -103,7 +103,8 @@
'xxx': []})
# Pop a blank line
- assert('' == lines.pop(0))
+ line = lines.pop(0)
+ assert line == '', "Expected empty line: %r" % line
# Grab the entity description. It might span multiple lines.
symbol['desc'] = lines.pop(0)
@@ -111,7 +112,8 @@
symbol['desc'] += lines.pop(0)
# Pop a blank line
- assert ('' == lines.pop(0))
+ line = lines.pop(0)
+ assert line == '', "Expected empty line: %r" % line
# Populate the rest of the human-readable data.
# First try to read the parameters/members information. We are finished
--
To view, visit
http://gerrit.ovirt.org/34362
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59dbb1c8d3760af7d3f3049227f6ad8ceeaa402a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>