diff options
author | Ross Burton <ross@burtonini.com> | 2021-10-13 16:10:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-14 22:37:43 +0100 |
commit | ca8ef6bc38b8bfd772ff19931b49a076de5c1ec4 (patch) | |
tree | b426b17223a36727dd6dd61ab36d48e5446d025f | |
parent | bd5a07fbcb6d12414975a38b0920eb9df79042fd (diff) | |
download | poky-ca8ef6bc38b8bfd772ff19931b49a076de5c1ec4.tar.gz |
bitbake: codegen: implement ast.NodeVisitor.visit_Constant
Since Python 3.8 visit_Num(), visit_Str() and so on are all deprecated
and replaced with visit_Constant. We can't yet remove the deprecated
functions until we require 3.8, but we can implement visit_Constant to
silence the deprecation warnings.
(Bitbake rev: 4edd5767fc6d699f5262862b763b6a99ad1f1bbf)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/codegen.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bitbake/lib/codegen.py b/bitbake/lib/codegen.py index 62a6748c47..6955a7ada5 100644 --- a/bitbake/lib/codegen.py +++ b/bitbake/lib/codegen.py | |||
@@ -401,6 +401,12 @@ class SourceGenerator(NodeVisitor): | |||
401 | def visit_Num(self, node): | 401 | def visit_Num(self, node): |
402 | self.write(repr(node.n)) | 402 | self.write(repr(node.n)) |
403 | 403 | ||
404 | def visit_Constant(self, node): | ||
405 | # Python 3.8 deprecated visit_Num(), visit_Str(), visit_Bytes(), | ||
406 | # visit_NameConstant() and visit_Ellipsis(). They can be removed once we | ||
407 | # require 3.8+. | ||
408 | self.write(repr(node.value)) | ||
409 | |||
404 | def visit_Tuple(self, node): | 410 | def visit_Tuple(self, node): |
405 | self.write('(') | 411 | self.write('(') |
406 | idx = -1 | 412 | idx = -1 |