局限性

此页面用于列出使编译代码的语义异于 Python 中的语义的 Cython Bug。大多数缺失特征已在 Cython 0.15 中修复。注意,未来 Cython 1.0 版本计划提供完整 Python 语言兼容。

Below is a list of differences that we will probably not be addressing. Most of these things that fall more into the implementation details rather than semantics, and we may decide not to fix (or require a –pedantic flag to get).

嵌套元组自变量的解包

def f((a,b), c):
    pass
					

这在 Python 3 中被删除。

审查支持

While it is quite possible to emulate the interface of functions in Cython’s own function type, and recent Cython releases have seen several improvements here, the “inspect” module does not consider a Cython implemented function a “function”, because it tests the object type explicitly instead of comparing an abstract interface or an abstract base class. This has a negative impact on code that uses inspect to inspect function objects, but would require a change to Python itself.

堆栈帧

Currently we generate fake tracebacks as part of exception propagation, but don’t fill in locals and can’t fill in co_code. To be fully compatible, we would have to generate these stack frame objects at function call time (with a potential performance penalty). We may have an option to enable this for debugging.

恒等 vs 相等对于推断文字

a = 1.0          # a inferred to be C type 'double'
b = c = None     # b and c inferred to be type 'object'
if some_runtime_expression:
    b = a        # creates a new Python float object
    c = a        # creates a new Python float object
print(b is c)     # most likely not the same object