cython/cython

Coercing a sliced C array to Python should create a list

開放

#2,159 建立於 2018年3月17日

 (3 則留言) (0 個反應) (0 位負責人)Python (1,517 個分叉)batch import
Cython Language FeatureType Analysisenhancementgood first issuehelp wanted

倉庫指標

星標
 (8,663 顆星)
PR 合併指標
 (平均合併 45天 12小時) (30 天內合併 52 個 PR)

描述

Cython already copies a C array into a Python list automatically on object coercion. It should do the same for sliced C arrays, e.g.

def test():
    cdef int i
    cdef int a[100]
    for i in range(100):
        a[i] = i**2
    return a[:20]  # rejected by type analysis

Currently results in Cannot convert 'int *' to Python object.

貢獻者指南