+# mode: compile
+
cdef public struct Foo:
int a, b
+# mode: compile
+
cdef swallow
def spam(w, int x = 42, y = "grail", z = swallow):
+# mode: compile
cdef extern from *:
+# mode: compile
+
cdef enum E:
z
+# mode: compile
+
cdef void f1(char *argv[]):
f2(argv)
+# mode: compile
+
cdef void spam():
cdef long long L
cdef unsigned long long U
+# mode: compile
+
def f(a, b):
assert a, a+b
+# mode: compile
+
cdef enum E:
spam, eggs
+# mode: compile
+
cdef extern from *:
ctypedef int intptr_t
+# ticket: 444
+# mode: compile
def test():
cdef object[int] not_assigned_to
+# mode: compile
+
def f():
x = open("foo")
+# mode: compile
+
cdef int f() except -1:
cdef object x, y, z, w
cdef int i
+# mode: compile
# cython: boundscheck = False
# cython: ignoreme = OK
# cython: warn.undeclared = False
+# mode: compile
+
cdef extern from "callingconvention.h":
pass
+# mode: compile
+
def f(obj, int i, float f, char *s1, char s2[]):
pass
+# mode: compile
+
cdef extern:
cdef func(int[])
+# mode: compile
+
cdef void foo():
cdef int bool, int1=0, int2=0, int3=0, int4=0
cdef object obj1, obj2, obj3, obj4
+# mode: compile
+
cdef void foo():
cdef int i1, i2=0
cdef char c1=0, c2
+# ticket: 518
+# mode: compile
+
cdef extern from "cast_ctypedef_array_T518_helper.h":
cdef struct __foo_struct:
int i, j
+# mode: compile
+
cdef extern class external.Spam:
pass
+# mode: compile
+
cdef extern from "cheese.h":
pass
+# mode: compile
+
cdef extern from *:
int spam
+# mode: compile
+
cdef enum Spam:
a
b, c,
+# mode: compile
+
cdef int i, j, k
cdef object a, b, x
+# ticket: 4
+# mode: compile
+
from a cimport b
cdef int **t = b.foo(NULL)
+# ticket: 248
+# mode: compile
+
from ewing8 cimport (Foo,
+# mode: compile
+
__doc__ = u"""
>>> s = Swallow()
>>> s.spam(1)
+# mode: compile
+
cdef extern from "cnamespec.h":
int a "c_a", b "c_b"
+# mode: compile
+
def f():
cdef int int1, int2=0, int3=1
cdef char char1=0
+# mode: compile
+
cdef void f():
cdef void *p
cdef char *q=NULL
+# mode: compile
+
cdef extern (int *[42]) spam, grail, swallow
cdef (int (*)()) brian():
+# mode: compile
+
cdef enum Grail:
k = 42
+# mode: compile
+
cdef class Tst:
cdef foo,
+# mode: compile
+
cdef class A:
cpdef a(self):
ma(self)
+# tag: cpp
+# mode: compile
+
cdef extern from "cpp_enums.h":
cdef enum Enum1:
Item1
+# tag: cpp
+# mode: compile
+
cdef extern from "operators.h":
cdef cppclass Operators:
Operators(int)
+# tag: cpp
+# mode: compile
+
cdef extern from "point.h" namespace "geometry":
cdef struct Point:
+# tag: cpp
+# mode: compile
+
cdef extern from *:
cdef cppclass Foo[T]:
pass
+# tag: cpp
+# mode: compile
+
cdef extern from "templates.h":
cdef cppclass TemplateTest1[T]:
TemplateTest1()
+# mode: compile
+
ctypedef struct Foo:
int blarg
+# mode: compile
+
ctypedef int *IntPtr
ctypedef unsigned long ULong
cdef extern IntPtr spam
+# ticket: 355
+# mode: compile
+
ctypedef public class Time [type MyTime_Type, object MyTimeObject]:
def __init__(self, seconds):
self.seconds = seconds
+# mode: compile
+
ctypedef class spam:
pass
+# mode: compile
+
ctypedef enum parrot_state:
alive = 1
dead = 2
+# mode: compile
+
ctypedef public api class Foo [type PyFoo_Type, object PyFooObject]:
pass
+# mode: compile
+
ctypedef struct order:
int spam
int eggs
+# mode: compile
+
ctypedef union pet:
int cat
float dog
+# mode: compile
+
cdef void f():
cdef unsigned long x
cdef object y=0
+# mode: compile
+
cdef extern short int s
cdef extern long int l
cdef extern long long ll
+# mode: compile
+
cdef class Tomato:
def eject(self):
+# mode: compile
+
cdef extern from "declarations.h":
pass
+# mode: compile
+
def f(a, b):
global g
del g
+# mode: compile
+
cdef void spam():
cdef object x
del x[17:42]
+# mode: compile
+
"Welcome to the parrot module. It is currently resting."
def zap(polly, volts):
+# mode: compile
+
cdef class Spam:
pass
+# mode: compile
+
cimport dotted_cimport_submodule.a
import dotted_cimport_submodule.b
+# mode: compile
+
cdef char *s
s = r'\"HT\"'
+# ticket: 488
+# mode: compile
#from ... import foo
print ...
+# mode: compile
+
cdef void f():
try:
pass
+# mode: compile
+
cdef enum E:
a
+# mode: compile
+
cdef void foo():
cdef int bool, int1=0, int2=0
cdef float float1=0, float2=0
+# mode: compile
+
cdef int blarg(int i):
pass
+# mode: compile
+
cdef class C:
cdef f(self):
pass
+# mode: compile
+
cdef void f():
"This is a pseudo doc string."
+# mode: compile
+
cdef char *f():
raise Exception
+# mode: compile
# Spurious gcc3.3 warnings about incompatible pointer
# types passed to C method
+# mode: compile
+
cdef class A:
cdef void f(self, x):
pass
+# mode: compile
+
cdef class Blarg:
pass
+# mode: compile
+
cdef struct xmlDoc:
int i
+# mode: compile
+
cdef extern from "excvalcheck.h":
pass
+# mode: compile
+
cdef int spam() except 42:
pass
+# mode: compile
+
cdef int spam() except -1:
eggs = 42
+# mode: compile
+
cdef extern class somewhere.Swallow:
pass
+# mode: compile
+
cdef class Spam:
cdef int tons
+# mode: compile
+
cdef class Grail:
def __add__(int x, float y):
+# mode: compile
+
cdef class Spam:
def __delattr__(self, n):
+# mode: compile
+
cdef class Spam:
def __delitem__(self, i):
+# mode: compile
+
cdef class Spam:
def __delslice__(self, Py_ssize_t i, Py_ssize_t j):
+# mode: compile
+
cdef class Foo:
def __delete__(self, i):
+# mode: compile
+
cdef class Foo:
def __get__(self, i, c):
+# mode: compile
+
cdef class Foo:
def __set__(self, i, v):
+# mode: compile
+
cdef extern int i
cdef extern char *s[]
cdef extern void spam(char c)
+# mode: compile
+
cdef extern class external.Spam [object SpamObject]:
pass
+# mode: compile
+
cdef class Spam
cdef class Grail:
+# mode: compile
+
cdef class Spam:
def __getattr__(self, x):
+# mode: compile
+
cdef class Spam:
def __getitem__(self, x):
+# mode: compile
+
cdef class Spam:
def __hash__(self):
+# mode: compile
+
cdef extern class Spam.Eggs.Ham:
pass
+# mode: compile
+
from crunchytype cimport Crunchy
cdef class Sub2(Crunchy):
+# mode: compile
+
cdef class Spam:
def __index__(self):
+# mode: compile
+
cdef class Parrot:
pass
+# mode: compile
+
cdef class Parrot:
pass
+# mode: compile
+
cdef class Spam:
property eggs:
+# mode: compile
+
cdef class Spam:
property eggs:
+# mode: compile
+
cdef class Spam:
property eggs:
+# mode: compile
+
cdef class Spam:
property eggs:
+# mode: compile
+
cdef class Spam:
property eggs:
+# mode: compile
+
cdef class Spam:
cdef public char c
cdef public int i
+# mode: compile
+
cdef class Spam:
def __setattr__(self, n, x):
+# mode: compile
+
cdef class Spam:
def __setitem__(self, i, x):
+# mode: compile
+
cdef class Spam:
def __setslice__(self, Py_ssize_t i, Py_ssize_t j, x):
+# mode: compile
cimport cython
+# mode: compile
+
def f(a, b, c):
cdef int i
for a in b:
+# mode: compile
+
cdef void spam():
cdef int i, j=0, k=0
for i from 0 <= i < 10:
+# mode: compile
+
cdef int x
x = 42
+# mode: compile
+
def f():
from spam import eggs
from spam.morespam import bacon, eggs, ham
+# mode: compile
+
cdef int grail():
cdef int (*spam)()
spam = &grail
+# mode: compile
+
def f(x, y):
x = y
+# mode: compile
+
global __name__
print __name__
+# mode: compile
+
def f():
global a,b,c,d
a = b
+# mode: compile
+
cdef int a_global_int
cdef a_global_pyobject
+# mode: compile
+
ctypedef enum someenum_t:
ENUMVALUE_1
ENUMVALUE_2
+# mode: compile
+
cdef class vector:
def __div__(vector self, double factor):
cdef object result = vector()
+# mode: compile
+
cdef enum Color:
red
white
+# mode: compile
+
cdef:
struct PrivFoo:
+# mode: compile
+
def f():
import spam
import spam.eggs
+# mode: compile
+
def f(obj1, obj2, obj3):
cdef int int1, int2=0, int3=0
cdef float flt1, *ptr1=NULL
+# mode: compile
+
cdef int* a
cdef object x
+# mode: compile
+
cdef class A:
def __getitem__(self, x):
+# mode: compile
+
cdef void __stdcall f():
pass
+# mode: compile
+
cdef class Position
cdef class Point(Position)
cdef class Vector(Point)
+# mode: compile
+
cdef class A:
cdef object x
+# mode: compile
+
def f():
cdef int i=0
global mylist
+# mode: compile
+
cdef extern from "string.h":
void memcpy(void* des, void* src, int size)
+# mode: compile
+
ctypedef enum foo:
FOO
+# mode: compile
+
cdef class C:
cdef object foo
+# mode: compile
+
cdef class T:
cdef int a[1]
+# mode: compile
+
def f(x,):
pass
+# mode: compile
+
ctypedef struct BB:
void (*f) (void* state)
+# mode: compile
+
cimport libc
cimport libc.stdio
+# mode: compile
+
from libc.errno cimport *
if errno == EDOM : pass
+# mode: compile
+
from libc.math cimport (M_E, M_LOG2E, M_LOG10E, M_LN2, M_LN10, M_PI, M_PI_2,
M_PI_4, M_1_PI, M_2_PI, M_2_SQRTPI, M_SQRT2, M_SQRT1_2)
from libc.math cimport (acos, asin, atan, atan2, cos, sin, tan, cosh, sinh,
+# mode: compile
+
from libc.signal cimport *
cdef void sighdl(int signum) nogil:
+# mode: compile
+
cdef extern unsigned long x
cdef extern long unsigned y
+# mode: compile
+
cdef void foo():
cdef int bool, int1=0, int2=0
bool = int1 < int2
+# mode: compile
+
"""A long module docstring.\r
\r
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sit amet\r
+# mode: compile
+
cdef extern object g(object x) nogil
cdef extern void g2(object x) nogil
+# mode: compile
+
cdef class spam:
pass
+# mode: compile
+
cdef void spam():
eggs = None
+# mode: compile
+
cdef extern class external.Spam [object Spam]: pass
cdef extern class external.Eggs [object Eggs]: pass
+# mode: compile
+
cdef char *p1
cdef int *p2
cdef int x
+# mode: compile
+
cdef extern void spam(int, char *)
+# mode: compile
+
__doc__ = u"""
>>> fiches_CP
[]
+# mode: compile
+
cimport posix
cimport posix.unistd
+# mode: compile
# --
ctypedef int Int0
+# mode: compile
# --
ctypedef int Int0
+# mode: compile
# --
ctypedef int Int0
+# mode: compile
+
cdef class Foo1: pass
cdef class Foo2: pass
cdef class Foo3: pass
+# mode: compile
+
class A:
def foo(self):
return "A"
+# mode: compile
+
class Spam:
def eggs(self):
+# mode: compile
+
cdef extern from "Python.h":
ctypedef struct PyTypeObject:
pass
+# mode: compile
+
__doc__ = u"""
>>> main()
3.14159265358979323846
+# mode: compile
+
cdef struct S:
char c
unsigned char uc
+# mode: compile
+
def f(a, b, c, d, e, f, g, h, i):
a = b[c:d, e:f:g, ..., h, :i:]
+# mode: compile
+
DEF nan = float('nan')
DEF inf = float('inf')
DEF minf = -float('inf')
+# mode: compile
+
cdef class Grail:
def __cinit__(self, spam = None):
+# mode: compile
+
cdef class C:
def __cinit__(self):
"This is an unusable docstring."
+# mode: compile
+
cdef class Spam:
cdef int eggs
+# mode: compile
+
def spam():
raise Exception
+# mode: compile
+
def f(a, b, c, x):
cdef int i
a = b + c
+# mode: compile
+
def f(a, b, c, x):
cdef int i
a = b + c
+# mode: compile
+
cdef void f(obj):
cdef size_t i=0
cdef char *p
+# mode: compile
+
print sizeof(point*)
cdef foo(int i0, int i, list L0, list L, point p0, point p, point* ps):
+# mode: compile
+
cdef int x
x = 0xFFFFFFFF
+# ticket: 276
+# mode: compile
+
__doc__ = u"""
"""
+# mode: compile
+
def f(a, b):
cdef int i = 5
+# mode: compile
+
cdef void f() with gil:
x = 42
+# ticket: 117
+# mode: error
+
ctypedef object[float] mybuffer
_ERRORS = u"""
+# mode: error
# current restriction: cannot inherit from PyVarObject (see ticket #152)
+# mode: error
+
def f(*args, **kwargs):
pass
+# ticket: 307
+# mode: error
+
nonexisting(3, with_kw_arg=4)
_ERRORS = u"""
+# ticket: 517
+# mode: error
+
ctypedef void* VoidP
cdef class Spam:
+# mode: error
cdef pass
cdef void
+# mode: error
+
__doc__ = u"""
>>> call2()
>>> call3()
+# mode: error
+
def call5():
b(1,2,3,4,5)
+# mode: error
cdef class Test:
cdef __cinit__(self):
+# mode: error
+
cdef class C:
cdef void f(self):
pass
+# ticket: 370
+# mode: error
cdef int raiseit():
raise IndexError
+# mode: error
cpdef nogil: pass
cpdef nogil class test: pass
+# tag: cpp
+# mode: error
+
cdef extern from *:
cdef cppclass Foo:
Foo()
+# mode: error
# -*- coding: utf-8 -*-
# cython: language_level=3
+# ticket: 158
+# mode: error
+
def mult_decl_test():
print "%s" % vv
print "%s" % s
+# mode: error
def test() nogil:
pass
+# ticket: 290
+# mode: error
+
cdef packed foo:
pass
+# mode: error
+
def f():
cdef int int1, int3
cdef int *ptr1, *ptr2, *ptr3
+# mode: error
+
cdef spam(int i, char *s = "blarg", float f): # can't have default value
pass
+# mode: error
+
cdef void foo(obj):
cdef int i1
cdef char *p1
+# mode: error
+
cdef void spam():
None = 42
_ERRORS = u"""
+# mode: error
+
cimport cython
@cython.autotestdict(False)
+# mode: error
+
cdef char *spam() except -1:
pass
+# mode: error
+
cdef struct Spam
cdef extern int spam(void) # function argument cannot be void
+# mode: error
+
cdef struct Foo
def f(Foo *p):
+# mode: error
+
cdef struct Grail
cdef extern object xobj # Python object cannot be extern
+# mode: error
+
def f():
cdef int int1, int2
cdef char *ptr
+# mode: error
+
ctypedef struct struct_type_not_boolean:
int i
float f
+# mode: error
+
cdef object[int] buf
cdef class A:
cdef object[int] buf
+# mode: error
+
cimport e_bufaccess_pxd # was needed to provoke a bug involving ErrorType
import cython
+# mode: error
+
cdef int i
i()
+# mode: error
+
cimport cython
@cython.callspec("")
+# ticket: 241
+# mode: error
+
cdef some_function(x, y):
pass
+# mode: error
+
cdef int
cdef extern from *:
+# mode: error
+
cdef class A:
cdef int value = 3
+# mode: error
+
cdef struct spam:
pass
+# mode: error
+
cdef enum Spam:
a, b, c
+# mode: error
+
cdef class C:
cdef void f(self):
pass
+# mode: error
+
cdef void foo():
cdef int bool, int1
cdef char *ptr2
+# mode: error
+
cdef struct Spam:
int i
char c
+# mode: error
+
ctypedef struct Spam
cdef extern from *:
+# mode: error
+
cdef struct Foo
ctypedef struct Foo:
+# mode: error
+
cdef extern void fa[5]()
cdef extern int af()[5]
cdef extern int ff()()
+# mode: error
_ERRORS = u"""
4:4 Expected a newline after decorator
+# mode: error
+
cdef struct S:
int m
+# mode: error
# cython: nonexistant = True
# cython: boundscheck = true
+# mode: error
try:
raise KeyError
+# mode: error
+
ctypedef int (*spamfunc)(int, char *) except 42
ctypedef int (*grailfunc)(int, char *)
+# mode: error
+
cdef class C:
cdef object __weakref__
+# mode: error
+
cimport e_func_in_pxd_support
_ERRORS = u"""
+# mode: error
+
def f(obj1, obj2):
cdef int int1, int2, int3
cdef float flt1, *ptr1
+# mode: error
# cython: language_level=2
def int_literals():
+# mode: error
# cython: language_level=3
def int_literals():
+# mode: error
+
def f(obj1a, obj1b):
cdef int int1, int2, int3
cdef int *ptr2
+# mode: error
+
cdef extern grail(char *s, int i)
cdef extern spam(char *s, int i,...)
+# mode: error
+
cdef class C:
cdef void f(self) nogil:
pass
+# mode: error
+
cdef extern from *:
cdef void f()
cdef void (*fp)() nogil
+# mode: error
+
cdef signed float e
cdef unsigned float f
cdef signed double g
+# mode: error
+
cdef extern class Grail.Shrubbery
cdef void spam(Shrubbery sh not None):
+# mode: error
+
def eggs(int x not None, char* y not None):
pass
_ERRORS = u"""
+# mode: error
+
def f():
cdef int int1, int2
cdef int *ptr
+# ticket: 290
+# mode: error
+
cdef extern:
cdef packed struct MyStruct:
char a
+# mode: error
+
def f():
cdef char *str1
cdef float flt1, flt2, flt3
+# mode: error
+
cimport e_pxdimpl_imported
_ERRORS = u"""
+# mode: error
+
cdef object x
cdef struct spam:
+# mode: error
+
cdef void g():
cdef int i
return i # error
+# mode: error
+
cdef struct unbekannt
cdef int n
n = sizeof(unbekannt)
+# mode: error
+
def f(obj2):
cdef int *ptr1
obj1 = obj2[ptr1::] # error
+# mode: error
+
cdef int c1 = "t" # works
cdef int c2 = "te" # fails
cdef int cx = "test" # fails
+# mode: error
+
def f():
cdef int int2
cdef char *ptr1, *ptr2, *ptr3
+# mode: error
+
cdef int x = 3
if x == NONEXISTING:
+# mode: error
+
cdef object blarg
def foo(obj):
+# mode: error
+
cdef class Spam
cdef extern class external.Eggs
_ERRORS = u"""
+# mode: error
+
def f():
cdef int int1
cdef char *str2
+# mode: error
+
def f(a, b):
cdef int i
break # error
+# mode: error
# coding=ASCII
"""
+# mode: error
+
__doc__ = u"""
>>> e = ExtClass()
>>> e.get()
+# mode: error
# invalid syntax (not handled by the parser)
+# mode: error
# wrong size RHS (as handled by the parser)
+# mode: error
# invalid syntax (as handled by the parser)
+# mode: error
+
from __future__ import braces
_ERRORS = u"""
+# mode: error
+
def f():
a = <foao>True
+# mode: error
+
def f():
cdef int* p
if false():
+# ticket: 262
+# mode: error
+
cdef class Album
cdef class SessionStruct:
+# ticket: 156
+# mode: error
cdef class B:
cpdef b():
+# ticket: 165
+# mode: error
cdef class A:
cpdef a(int not_self):
+# mode: error
+
cdef object f(object x) nogil:
pass
+# mode: error
+
cdef class C:
cdef void f(self):
pass
+# mode: error
+
cdef extern from *:
cdef void f()
cdef void (*fp)() nogil
+# mode: error
+
import os
DEF ospath = os.path
+# ticket: 418
+# mode: error
+
import somemod.child
cdef somemod.child.something x
+# ticket: 286
+# mode: error
+
cdef class A:
pass
+# mode: error
# -*- coding: iso-8859-1 -*-
cdef Py_UCS4 char_ASCII = u'A'
+# mode: error
# -*- coding: iso-8859-1 -*-
cdef Py_UNICODE char_ASCII = u'A'
+# ticket: 313
+# mode: error
a = 3
+# ticket: 135
+# mode: error
def _runtime_True():
return True
+# mode: error
+
def f():
a = b # space space
c = d # space tab
+# mode: error
+
def f():
a = b
c = d
+# mode: error
+
def f():
a = b # space space
c = d # tab
+# mode: error
+
def f(obj1a, obj2a, obj3a, obj1b, obj2b, obj3b, obj4b):
obj1a, (obj2a, obj3a) = obj1b, (obj2b, obj3b, obj4b)
+# mode: error
# coding: ASCII
# ok:
+# mode: error
cimport cython
+# mode: error
cimport cython
+# ticket: 304
+# mode: error
def f():
print assert sizeof(int) == sizof(short) == sizeof(long)
+# mode: error
+
i = _this_global_name_does_not_exist_
def test(i):
+# mode: error
+
cdef extern from *:
void foo(void)
+# ticket: 295
+
cimport cython
+# ticket: 658
def outer(int x, *args, **kwargs):
"""
#cython: autotestdict=True
+
"""
Tests that autotestdict doesn't come into effect when
a __test__ is defined manually.
+# ticket: 252
+
cdef cf(default=None):
return default
+# ticket: 145
cimport cython
+# ticket: 354
cdef class Test:
"""
+# ticket: 589
cimport cython
+# tag: py3
+
__doc__ = u"""
>>> test_xrange()
0
+# ticket: 608
cdef class MyInt(int):
"""
+# ticket: 166
+
__doc__ = u"""
>>> l = None
>>> l.append(2)
+# ticket: 255
+
__doc__ = u""
# -------------------------------------------------------------------
+# ticket: 236
__doc__ = ''
+# ticket: 467
def simple_parallel_assignment_from_call():
"""
+# ticket: 466
# extension to T409
def simple_parallel_typed():
+# ticket: 227
+
from cpython.bool cimport bool
def foo(bool a):
+# ticket: 183
+
cimport cython
@cython.cdivision(True)
+# ticket: 477
+
import cython
@cython.locals(x=double)
cdef func(x):
+# ticket: 517
#cython: embedsignature=True
+
__doc__ = u"""
>>> a = A()
>>> a.h = 7
+# ticket: 462
cimport cython
+# ticket: 284
+
def no_cdef():
"""
>>> no_cdef()
+# ticket: 408
+
__doc__ = """
>>> call_with_tuple(1, 1.2, 'test', [1,2,3])
(1, 1.2, 'test', [1, 2, 3])
+# ticket: 99
+
cdef char c = 'c'
cdef char* s = 'abcdef'
+# ticket: 412
+
def f():
"""
>>> f()
+# ticket: 582
cimport cython
+# ticket: 505
+
cimport cython
cdef extern from "Python.h":
+# ticket: 18
+
__doc__ = u"""
>>> f = PyFoo()
>>> print(f.bar)
+# ticket: 87
__doc__ = u"""
>>> d = Defined()
+# ticket: 336
+
__doc__ = u"""
>>> print('\\n'.join(calls))
Py-Honk PyTestClass
+# ticket: 596
+
def simple(a, b):
"""
>>> kls = simple(1, 2)
+# ticket: 478
+
__doc__ = """
>>> Num(13).is_prime()
args (Num(13),) kwds {}
+# ticket: 554
+
def call_f(x):
"""
>>> call_f(2)
+# ticket: 537
__doc__ = u"""
>>> f1 = nested1()
+# ticket: 82
cimport cython
+# ticket: 445
+
def complex_double_cast(double x, double complex z):
"""
>>> complex_double_cast(1, 4-3j)
+# ticket: 446
+
import cython
cdef extern from "complex_int_T446_fix.h":
+# ticket: 305
+
cimport cython
def test_object_conversion(o):
+# ticket: 398
+
cdef extern from "complex_numbers_c89_T398.h": pass
include "complex_numbers_T305.pyx"
+# ticket: 398
+
cdef extern from "complex_numbers_c99_T398.h": pass
include "complex_numbers_T305.pyx"
+# ticket: 398
+
cdef extern from "complex_numbers_cxx_T398.h": pass
include "complex_numbers_T305.pyx"
+# ticket: 455
+
def in_sequence(x, seq):
"""
>>> in_sequence(1, [])
+# ticket: 411
+
cdef class A:
"""
>>> A().is_True()
+# tag: cpp
+
from libcpp cimport bool
def test_bool(bool a):
+# tag: cpp
+
__doc__ = u"""
>>> test_new_del()
(2, 2)
+# tag: cpp
+
cdef int raise_py_error() except *:
raise TypeError("custom")
+# tag: cpp
+
cdef int raise_TypeError() except *:
raise TypeError("custom")
+# tag: cpp
+
cdef extern from "cpp_namespaces_helper.h" namespace "A":
ctypedef int A_t
A_t A_func(A_t first, A_t)
+# tag: cpp
+
from cython.operator cimport dereference as deref
cdef extern from "cpp_templates_helper.h":
+# tag: cpp
+
cdef extern from "cpp_nonstdint.h":
ctypedef int Int24
ctypedef int Int56
+# tag: cpp
+
cimport cython.operator
from cython.operator cimport dereference as deref
+# tag: cpp
+
cdef extern from "vector" namespace "std":
cdef cppclass vector[T]:
+# tag: cpp
+
from cython.operator cimport dereference as d
from cython.operator cimport preincrement as incr
+# tag: cpp
+
from cython.operator import dereference as deref
cdef extern from "cpp_templates_helper.h":
+# ticket: 245
+
cimport crashT245_pxd
def f():
+# ticket: 333
#cython: autotestdict=True
# -------------------------------------------------------------------
+# ticket: 593
+
"""
>>> am_i_buggy
False
+# ticket: 384
+
"""
>>> test(3)
(3+1j)
+# ticket: 488
+
"""
>>> test()
"""
+# ticket: 208
+
def go_py_empty():
"""
>>> go_py_empty()
+# ticket: 316
+
cimport cython
@cython.test_fail_if_path_exists("//SimpleCallNode//NameNode[@name = 'enumerate']")
+# ticket: 232
+
cdef class MyExt:
cdef object attr
+# ticket: 235
+
__doc__ = u"""
>>> class FakeSeq(object):
... def __init__(self, length):
+# ticket: 409
+
def simple():
"""
>>> simple()
+# ticket: 258
+
cdef extern from "Python.h":
ctypedef class __builtin__.list [object PyListObject]:
+# ticket: 260
+
def floor_div_float(double a, double b):
"""
>>> floor_div_float(2, 1.5)
+# ticket: 480
+
def f(x):
return x
+# ticket: 254
+
def double_target(a, b):
"""
>>> double_target(0, 4)
+# ticket: 601
cdef unsigned long size2():
return 3
+# ticket: 533
def for_in():
"""
+# ticket: 372
+
cimport cython
@cython.test_assert_path_exists("//ForFromStatNode")
+# ticket: 228
+
__doc__ = u"""
>>> def py_iterator():
... if True: return
+# ticket: 494
+
__doc__ = """
>>> A.foo = foo
>>> print A().foo()
+# ticket: 494
+
cimport cython
class SomeNumber(object):
+# ticket: 491
def test_genexpr():
"""
+# ticket: 600
cimport cython
+# ticket: 326
+
__doc__ = u"""
>>> hash(A(5))
+# ticket: 267
+
"""
>>> constants(4)
1
+# ticket: 544
def count(i=[0]):
i[0] += 1
+# ticket: 400
cimport cython
+# ticket: 431
+
__doc__ = u"""
>>> s == s_interned
True
+# ticket: 562
+
class IPOW:
"""
>>> IPOW().__ipow__('a')
+# ticket: 195
+
__doc__ = u"""
#>>> py_identity = lambda x:x
#>>> py_identity(1) == cy_identity(1)
+# ticket: 605
+
cdef int cdef_CONST = 123
CONST = 456
+# ticket: 603
# Module scope lambda functions
+
__doc__ = """
>>> pow2(16)
256
+# ticket: 237
#def add_large_c():
# cdef unsigned long long val = 2**30 + 2**30
# return val
+# ticket: 598
# cython: language_level=3
def list_comp_in_closure():
+# ticket: 430
+
__doc__ = u"""
>>> sorted( get_locals(1,2,3, k=5) .items())
[('args', (2, 3)), ('kwds', {'k': 5}), ('x', 1), ('y', 'hi'), ('z', 5)]
+# ticket: 429
+
__doc__ = u"""
>>> sorted( get_locals(1,2,3, k=5) .items())
[('args', (2, 3)), ('kwds', {'k': 5}), ('x', 1), ('y', 'hi'), ('z', 5)]
+# ticket: 422
+
"""
>>> Foo.incr.__module__ is not None
True
+# ticket: 5
# this is ticket #5
__doc__ = u"""
+# ticket: 470
+
__doc__ = u"""
>>> func(**{'a' : 7})
True
+# ticket: 172
+# tag: numpy
+
__doc__ = u"""
>>> 1
1
+# ticket: 155
+# tag: numpy
+
"""
>>> myfunc()
0.5
+# tag: numpy
+
"""
>>> import sys
>>> 'numpy' in sys.modules
+# tag: numpy
# cannot be named "numpy" in order to not clash with the numpy module!
cimport numpy as np
+# ticket: 290
+
"""
>>> f()
(9, 9)
+# ticket: 425
+
cimport cython
@cython.test_assert_path_exists(
+# ticket: 489
+
"""
>>> xxx
[0, 1, 2, 3]
+# ticket: 313
# Ensure casting still works to void*
"""
+# ticket: 650
cimport cython
+# ticket: 203
+
cdef int get_bound(int m):
print u"get_bound(%s)"%m
return m
#!/usr/bin/env python
+
__doc__=u"""
>>> t = RefCountInMeth()
>>> t.chk_meth()
+# ticket: 404
+
cdef long foo(long x):
print "foo(%s)" % x
return x
+# ticket: 561
# The patch in #561 changes code generation for most special methods
# to remove the Cython-generated wrapper and let PyType_Ready()
# generate its own wrapper. (This wrapper would be used, for instance,
+# ticket: 561
+# tag: py2
# This file tests the behavior of special methods under Python 2
# after #561. (Only methods whose behavior differs between Python 2 and 3
# are tested here; see special_methods_T561.pyx for the rest of the tests.)
+# ticket: 561
+# tag: py3
# This file tests the behavior of special methods under Python 3
# after #561. (Only methods whose behavior differs between Python 2 and 3
# are tested here; see special_methods_T561.pyx for the rest of the tests.)
+# ticket: 399
+
__doc__ = u"""
>>> test(-2)
-2
+# ticket: 664
+
def assign():
"""
>>> assign()
+# ticket: 412
+
cdef int i = 'x'
cdef char c = 'x'
cdef char* s = 'x'
+# ticket: 409
# Extracted from sage/plot/plot3d/index_face_set.pyx:502
# Turns out to be a bug in implementation of PEP 3132 (Extended Iterable Unpacking)
+# ticket: 654
# function call arguments
+# ticket: 454
cimport cython
+# ticket: 298
+
"""
>>> func()
0 0
+# ticket: 287
+
__doc__ = u"""
>>> print( "%d" % Int() )
2
+# ticket: 373
+
import math
cdef class MyClass:
+# ticket: 303
+
__doc__ = """
>>> readonly() #doctest: +ELLIPSIS
Traceback (most recent call last):
+# ticket: 417
#cython: autotestdict=True
cdef class Foo:
+# ticket: 359
+
__doc__ = u"""
>>> py_string1.decode('ASCII') == 'test toast taste'
True
+# ticket: 184
+
"""
>>> c_call()
(-10, 10)
+# ticket: 536
__doc__ = """
>>> inner_result
+# tag: cpp
cimport cpp_overload_wrapper_lib as cppwrap_lib
+# tag: cpp
+
cimport cython