File: cpp_object_template.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (24 lines) | stat: -rw-r--r-- 546 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# mode: error
# tag: cpp

from libcpp.vector cimport vector

cdef class A:
    pass

def main():
    cdef vector[object] vo
    vo.push_back(object())
    cdef vector[A] va
    va.push_back(A())

def memview():
    import array
    cdef vector[int[:]] vmv
    vmv.push_back(array.array("i", [1,2,3]))

_ERRORS = u"""
10:15: Python object type 'Python object' cannot be used as a template argument
12:15: Python object type 'A' cannot be used as a template argument
17:15: Reference-counted type 'int[:]' cannot be used as a template argument
"""