pypy heapq c implementation

时间:2018-01-03 01:12:06

标签: python python-2.7 pypy

为什么heapq的c模块不能用于pypy,我该怎么做才能使它可用?

Python 2.7.13 (c5b147d52043, Jan 01 2018, 23:13:26)
[PyPy 5.11.0-alpha0 with GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``"translation toolchain" =
"RPyther"?  to write inteRPythers in''
>>>> import heapq
py version

当我修改源代码时:

try:
    from _heapq import *
    print "c version"
except ImportError:
    print "py version"
    pass

然而是cpython:

Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import heapq
c version
>>> exit()

感谢,

克里斯

0 个答案:

没有答案