提交 45d6c787 编写于 作者: S Stefan Hajnoczi

tracetool: use Python 2.4-compatible __import__() arguments

In Python 2.5 keyword arguments were added to __import__().  Avoid using
them to achieve Python 2.4 compatibility.
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: NLluís Vilanova <vilanova@ac.upc.edu>
上级 662da385
......@@ -204,7 +204,7 @@ def try_import(mod_name, attr_name = None, attr_default = None):
object or attribute value.
"""
try:
module = __import__(mod_name, fromlist=["__package__"])
module = __import__(mod_name, globals(), locals(), ["__package__"])
if attr_name is None:
return True, module
return True, getattr(module, str(attr_name), attr_default)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册