[bitbake-devel] [PATCH] parse/ast.py: MethodNode fix character mapping error

Aníbal Limón anibal.limon at linux.intel.com
Fri Jul 10 16:44:44 UTC 2015


When found an anonymous function the func name is made by filename
and lineno, the filename need to be converted to string before using
translation because produces an error of encoding.

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 lib/bb/parse/ast.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py
index 1130b14..4937006 100644
--- a/lib/bb/parse/ast.py
+++ b/lib/bb/parse/ast.py
@@ -149,7 +149,7 @@ class MethodNode(AstNode):
     def eval(self, data):
         text = '\n'.join(self.body)
         if self.func_name == "__anonymous":
-            funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(MethodNode.tr_tbl)))
+            funcname = ("__anon_%s_%s" % (self.lineno, str(self.filename).translate(MethodNode.tr_tbl)))
             text = "def %s(d):\n" % (funcname) + text
             bb.methodpool.insert_method(funcname, text, self.filename)
             anonfuncs = data.getVar('__BBANONFUNCS', False) or []
-- 
1.9.1




More information about the bitbake-devel mailing list