diff options
author | Markus Armbruster <armbru@redhat.com> | 2019-09-14 17:34:56 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-09-24 14:07:23 +0200 |
commit | 9d55380b5aecd4ae5324e7d4ab0a7dfc510b634d (patch) | |
tree | 7f4e84bbe481b6b933e0a193b2c6756f86a15091 /scripts | |
parent | 14c32795024c815316337b019bdf88d76b429af8 (diff) |
qapi: Remove null from schema language
We represent the parse tree as OrderedDict. We fetch optional dict
members with .get(). So far, so good.
We represent null literals as None. .get() returns None both for
"absent" and for "present, value is the null literal". Uh-oh.
Test features-if-invalid exposes this bug: "'if': null" is
misinterpreted as absent "if".
We added null to the schema language to "allow [...] an explicit
default value" (commit e53188ada5 "qapi: Allow true, false and null in
schema json", v2.4.0). Hasn't happened; null is still unused except
as generic invalid value in tests/.
To fix, we'd have to replace .get() by something more careful, or
represent null differently. Feasible, but we got more and bigger fish
to fry right now. Remove the null literal from the schema language.
Replace null in tests by another invalid value.
Test features-if-invalid now behaves as it should.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190914153506.2151-10-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qapi/common.py | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index b3383b17ef..ef7c7be4fd 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -548,10 +548,6 @@ class QAPISchemaParser(object): self.val = False self.cursor += 4 return - elif self.src.startswith('null', self.pos): - self.val = None - self.cursor += 3 - return elif self.tok == '\n': if self.cursor == len(self.src): self.tok = None |