我正在使用z3模块在Python中进行符号执行。在代码的某些部分,exec用于调用调用z3函数。代码段如下:
def can_be_satisfied(n):
path = get_path(n)
my_names, path =to_single_assignment(path)
s1 = "%s = z3.Ints('%s')" % (', '.join(my_names), ' '.join(my_names))
exec(s1, globals(), locals())
s = z3.Solver()
s2 = 's.add(%s)' % (', '.join([tosrc(i) for i in path]))
print(s2)
exec(s2, globals(), locals())
if s.check() == z3.sat:
print("sat:", s.model())
return True
else:
return False
正如我在z3模块的Python(http://www.cs.tau.ac.il/~msagiv/courses/asv/z3py/guide-examples.htm)文档中看到的,它包含属性'Ints'。但是,在执行程序后,代码段会生成以下错误:
File "code/symbolic_concolic_egt/symbolic/symbolic.py", line 69, in can_be_satisfied
exec(s1, globals(), locals())
File "<string>", line 1, in <module>
AttributeError: module 'z3' has no attribute 'Ints'
欢迎任何有关如何解决此问题的建议。 提前谢谢