Skip to content

Commit

Permalink
bitbake: codegen: implement ast.NodeVisitor.visit_Constant
Browse files Browse the repository at this point in the history
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: 97cf0660edd0e2f0df3a5d45b06e566327f90217)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
rossburton authored and rpurdie committed Oct 14, 2021
1 parent 174508c commit f595d95
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bitbake/lib/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ def visit_Bytes(self, node):
def visit_Num(self, node):
self.write(repr(node.n))

def visit_Constant(self, node):
# Python 3.8 deprecated visit_Num(), visit_Str(), visit_Bytes(),
# visit_NameConstant() and visit_Ellipsis(). They can be removed once we
# require 3.8+.
self.write(repr(node.value))

def visit_Tuple(self, node):
self.write('(')
idx = -1
Expand Down

0 comments on commit f595d95

Please sign in to comment.