1# ticket: 601 2 3cdef unsigned long size2(): 4 return 3 5 6def for_from_plain_ulong(): 7 """ 8 >>> for_from_plain_ulong() 9 0 10 1 11 2 12 """ 13 cdef object j = 0 14 for j from 0 <= j < size2(): 15 print j 16 17def for_in_plain_ulong(): 18 """ 19 >>> for_in_plain_ulong() 20 0 21 1 22 2 23 """ 24 cdef object j = 0 25 for j in range(size2()): 26 print j 27 28 29cdef extern from *: 30 """typedef unsigned long Ulong;""" 31 ctypedef unsigned long Ulong 32 33cdef Ulong size(): 34 return 3 35 36def for_from_ctypedef_ulong(): 37 """ 38 >>> for_from_ctypedef_ulong() 39 0 40 1 41 2 42 """ 43 cdef object j = 0 44 for j from 0 <= j < size(): 45 print j 46 47def for_in_ctypedef_ulong(): 48 """ 49 >>> for_in_ctypedef_ulong() 50 0 51 1 52 2 53 """ 54 cdef object j = 0 55 for j in range(size()): 56 print j 57 58 59class ForFromLoopInPyClass(object): 60 """ 61 >>> ForFromLoopInPyClass.i # doctest: +ELLIPSIS 62 Traceback (most recent call last): 63 AttributeError: ...ForLoopInPyClass... has no attribute ...i... 64 >>> ForFromLoopInPyClass.k 65 0 66 >>> ForFromLoopInPyClass.m 67 1 68 """ 69 for i from 0 <= i < 1: 70 pass 71 72 for k from 0 <= k < 2: 73 pass 74 75 for m from 0 <= m < 3: 76 pass 77