简体   繁体   English

在Python 3.3中使用Z3Py

[英]Using Z3Py With Python 3.3

My Situation 我的情况

I've installed Microsoft Z3 ( Z3 [version 4.3.0 - 64 bit]. (C) 2006 ) and it's pyc binaries for Python2. 我已经安装了Microsoft Z3( Z3 [version 4.3.0 - 64 bit]. (C) 2006 4.3.0-64 Z3 [version 4.3.0 - 64 bit]. (C) 2006 ),它是Python2的pyc二进制文件。

I've written an Python3 package which needs access to z3 functionality. 我编写了一个Python3程序包,该程序包需要访问z3功能。

In order to be able to use the pyc binaries with my Python3 package, I decompyle the z3 binaries and applied 2to3 . 为了能够使用pyc与我Python3包二进制文件,我decompylez3的二进制文件和应用2to3

My Problem 我的问题

Int('string') doesn't work because Z3Py isn't able to handle the new <class 'str'> used as 'string' argument: Int('string')不起作用,因为Z3Py无法处理用作'string'参数的新<class 'str'> class'str <class 'str'>

>>> import z3; z3.Int('abc')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".\bin\z3.py", line 2931, in Int
    return ArithRef(Z3_mk_const(ctx.ref(), to_symbol(name, ctx), IntSort(ctx).ast), ctx)
  File ".\bin\z3.py", line 72, in to_symbol
    return Z3_mk_string_symbol(_get_ctx(ctx).ref(), s)
  File ".\bin\z3core.py", line 1430, in Z3_mk_string_symbol
    r = lib().Z3_mk_string_symbol(a0, a1)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

My Questions 我的问题

  • It's a little bit hacky to need to decompyle Z3's *.pyc files first. 首先需要对Z3的*.pyc文件进行decompyle有点decompyle So, are there any Z3Py source codes available? 那么,有没有可用的Z3Py源代码?
  • Is there already an existing Z3Py port to Python3? 是否已经存在Python3的Z3Py端口?
  • Any other idea how to get Z3Py to run with Python3 ? 还有其他想法如何使Z3Py与Python3一起运行

Thanks. 谢谢。 - If anything's unclear, please leave a question comment. -如果不清楚,请发表问题评论。

The unstable (work-in-progress) has support for Python 3. This feature will be available in the next Z3 release (v4.3.2). unstable (正在开发中)支持Python3。此功能将在下一个Z3版本(v4.3.2)中提供。 In the meantime, you can build the unstable branch using the instructions found here . 同时,您可以按照此处的说明构建unstable分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM