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: c05fdba174a206a756d2d6d283f2c901fd2ad474)

Signed-off-by: Ross Burton <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
  • Loading branch information
rossburton authored and rpurdie committed Oct 13, 2021
1 parent 14811c9 commit 9d00017
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 9d00017

Please sign in to comment.