commit 0f88d6d6d0dd9d1ce5abb7f324fdd65687ef958a
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Thu Feb 12 16:09:11 2015 +0100
Utils: process only Name nodes in get_module_tools
PktgenTx test module code made Python ast module crashing.
This was due to unhandled case while walking the code tree.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/Utils.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Common/Utils.py b/lnst/Common/Utils.py
index d7dcda3..19ac898 100644
--- a/lnst/Common/Utils.py
+++ b/lnst/Common/Utils.py
@@ -182,6 +182,8 @@ def get_module_tools(module_path):
fn = getattr(node, 'func')
if isinstance(fn, Attribute):
val = getattr(fn, 'value')
+ if not isinstance(val, ast.Name):
+ continue
if ('self' == getattr(val, 'id')):
if ( 'exec_from' == getattr(fn, 'attr')):
tool = getattr((getattr(node, 'args')[0]), 's')
Show replies by date