Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
7a787e18
Commit
7a787e18
authored
Aug 23, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move declarators in tests.
parent
aa0d6c56
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
78 additions
and
77 deletions
+78
-77
tests/compile/arrayptrcompat.pyx
tests/compile/arrayptrcompat.pyx
+1
-1
tests/compile/extpymemberdef.pyx
tests/compile/extpymemberdef.pyx
+1
-1
tests/compile/index.pyx
tests/compile/index.pyx
+1
-1
tests/compile/inplace_lhs.pyx
tests/compile/inplace_lhs.pyx
+1
-1
tests/compile/jiba6.pyx
tests/compile/jiba6.pyx
+1
-1
tests/compile/khavkine1.pyx
tests/compile/khavkine1.pyx
+1
-1
tests/errors/declareafteruse_T158.pyx
tests/errors/declareafteruse_T158.pyx
+1
-1
tests/memoryview/compile_declarations.pyx
tests/memoryview/compile_declarations.pyx
+1
-1
tests/memoryview/cythonarray.pyx
tests/memoryview/cythonarray.pyx
+1
-1
tests/memoryview/memoryview.pyx
tests/memoryview/memoryview.pyx
+1
-1
tests/memoryview/memslice.pyx
tests/memoryview/memslice.pyx
+19
-19
tests/memoryview/numpy_memoryview.pyx
tests/memoryview/numpy_memoryview.pyx
+20
-20
tests/run/carray_slicing.pyx
tests/run/carray_slicing.pyx
+3
-3
tests/run/carrays.pyx
tests/run/carrays.pyx
+2
-2
tests/run/cdef_function_kwargs.pyx
tests/run/cdef_function_kwargs.pyx
+1
-1
tests/run/cdefassign.pyx
tests/run/cdefassign.pyx
+2
-1
tests/run/charencoding.pyx
tests/run/charencoding.pyx
+1
-1
tests/run/charescape.pyx
tests/run/charescape.pyx
+1
-1
tests/run/coercearraytoptr.pyx
tests/run/coercearraytoptr.pyx
+1
-1
tests/run/cpp_stl_string.pyx
tests/run/cpp_stl_string.pyx
+1
-1
tests/run/cvardef.pyx
tests/run/cvardef.pyx
+2
-2
tests/run/cython_includes.pyx
tests/run/cython_includes.pyx
+1
-1
tests/run/dietachmayer1.pyx
tests/run/dietachmayer1.pyx
+1
-1
tests/run/enumerate_T316.pyx
tests/run/enumerate_T316.pyx
+1
-1
tests/run/fused_types.pyx
tests/run/fused_types.pyx
+4
-4
tests/run/inplace.pyx
tests/run/inplace.pyx
+1
-1
tests/run/lepage_1.pyx
tests/run/lepage_1.pyx
+1
-1
tests/run/memoryview_namespace_T775.pyx
tests/run/memoryview_namespace_T775.pyx
+1
-1
tests/run/py_unicode_strings.pyx
tests/run/py_unicode_strings.pyx
+1
-1
tests/run/r_primes.pyx
tests/run/r_primes.pyx
+1
-1
tests/run/r_pythonapi.pyx
tests/run/r_pythonapi.pyx
+1
-1
tests/run/setjmp.pyx
tests/run/setjmp.pyx
+1
-1
tests/run/type_inference.pyx
tests/run/type_inference.pyx
+1
-1
No files found.
tests/compile/arrayptrcompat.pyx
View file @
7a787e18
...
@@ -6,7 +6,7 @@ cdef enum E:
...
@@ -6,7 +6,7 @@ cdef enum E:
cdef
void
f
():
cdef
void
f
():
cdef
int
*
p
cdef
int
*
p
cdef
void
*
v
cdef
void
*
v
cdef
int
a
[
5
]
cdef
int
[
5
]
a
cdef
int
i
=
0
cdef
int
i
=
0
cdef
E
e
=
z
cdef
E
e
=
z
p
=
a
p
=
a
...
...
tests/compile/extpymemberdef.pyx
View file @
7a787e18
...
@@ -10,7 +10,7 @@ cdef class Spam:
...
@@ -10,7 +10,7 @@ cdef class Spam:
cdef
public
float
f
cdef
public
float
f
cdef
public
double
d
cdef
public
double
d
cdef
public
char
*
s
cdef
public
char
*
s
cdef
readonly
char
a
[
42
]
cdef
readonly
char
[
42
]
a
cdef
public
object
o
cdef
public
object
o
cdef
readonly
int
r
cdef
readonly
int
r
cdef
readonly
Spam
e
cdef
readonly
Spam
e
tests/compile/index.pyx
View file @
7a787e18
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
def
f
(
obj1
,
obj2
,
obj3
):
def
f
(
obj1
,
obj2
,
obj3
):
cdef
int
int1
,
int2
=
0
,
int3
=
0
cdef
int
int1
,
int2
=
0
,
int3
=
0
cdef
float
flt1
,
*
ptr1
=
NULL
cdef
float
flt1
,
*
ptr1
=
NULL
cdef
int
array1
[
42
]
cdef
int
[
42
]
array1
array1
[
int2
]
=
0
array1
[
int2
]
=
0
int1
=
array1
[
int2
]
int1
=
array1
[
int2
]
flt1
=
ptr1
[
int2
]
flt1
=
ptr1
[
int2
]
...
...
tests/compile/inplace_lhs.pyx
View file @
7a787e18
...
@@ -7,7 +7,7 @@ def test():
...
@@ -7,7 +7,7 @@ def test():
cdef
int
i
=
1
,
j
=
2
,
k
=
3
cdef
int
i
=
1
,
j
=
2
,
k
=
3
cdef
float
x
=
1
,
y
=
2
,
z
=
3
cdef
float
x
=
1
,
y
=
2
,
z
=
3
cdef
object
a
=
1
,
b
=
2
,
c
=
3
,
d
=
4
,
e
=
5
cdef
object
a
=
1
,
b
=
2
,
c
=
3
,
d
=
4
,
e
=
5
cdef
int
m
[
3
]
cdef
int
[
3
]
m
m
[
0
]
=
0
m
[
0
]
=
0
m
[
1
]
=
1
m
[
1
]
=
1
m
[
2
]
=
1
m
[
2
]
=
1
...
...
tests/compile/jiba6.pyx
View file @
7a787e18
...
@@ -4,7 +4,7 @@ cdef extern from "string.h":
...
@@ -4,7 +4,7 @@ cdef extern from "string.h":
void
memcpy
(
void
*
des
,
void
*
src
,
int
size
)
void
memcpy
(
void
*
des
,
void
*
src
,
int
size
)
cdef
void
f
():
cdef
void
f
():
cdef
float
f1
[
3
]
cdef
float
[
3
]
f1
cdef
float
*
f2
cdef
float
*
f2
f2
=
f1
+
1
f2
=
f1
+
1
memcpy
(
f1
,
f2
,
1
)
memcpy
(
f1
,
f2
,
1
)
...
...
tests/compile/khavkine1.pyx
View file @
7a787e18
# mode: compile
# mode: compile
cdef
class
T
:
cdef
class
T
:
cdef
int
a
[
1
]
cdef
int
[
1
]
a
cdef
object
b
cdef
object
b
...
...
tests/errors/declareafteruse_T158.pyx
View file @
7a787e18
...
@@ -50,7 +50,7 @@ baz[0] = d
...
@@ -50,7 +50,7 @@ baz[0] = d
cdef
int
*
baz
cdef
int
*
baz
print
var
[
0
][
0
]
print
var
[
0
][
0
]
cdef
unsigned
long
long
var
[
100
][
100
]
cdef
unsigned
long
long
[
100
][
100
]
var
# in 0.11.1 these are warnings
# in 0.11.1 these are warnings
FUTURE_ERRORS
=
u"""
FUTURE_ERRORS
=
u"""
...
...
tests/memoryview/compile_declarations.pyx
View file @
7a787e18
...
@@ -68,4 +68,4 @@ cdef double[:, :] m3 = <double[:10:1, :10]> NULL
...
@@ -68,4 +68,4 @@ cdef double[:, :] m3 = <double[:10:1, :10]> NULL
cdef
double
[:,
:,
:]
m4
=
<
double
[:
10
,
:
10
,
:
10
]
>
NULL
cdef
double
[:,
:,
:]
m4
=
<
double
[:
10
,
:
10
,
:
10
]
>
NULL
cdef
double
[:,
:,
:]
m5
=
<
double
[:
10
,
:
10
,
:
10
:
1
]
>
NULL
cdef
double
[:,
:,
:]
m5
=
<
double
[:
10
,
:
10
,
:
10
:
1
]
>
NULL
cdef
double
[:,
:,
:]
m6
=
<
double
[:
10
:
1
,
:
10
,
:
10
]
>
NULL
cdef
double
[:,
:,
:]
m6
=
<
double
[:
10
:
1
,
:
10
,
:
10
]
>
NULL
\ No newline at end of file
tests/memoryview/cythonarray.pyx
View file @
7a787e18
...
@@ -184,7 +184,7 @@ def test_cyarray_from_carray():
...
@@ -184,7 +184,7 @@ def test_cyarray_from_carray():
0 8 21
0 8 21
0 8 21
0 8 21
"""
"""
cdef
int
a
[
7
][
8
]
cdef
int
[
7
][
8
]
a
for
i
in
range
(
7
):
for
i
in
range
(
7
):
for
j
in
range
(
8
):
for
j
in
range
(
8
):
a
[
i
][
j
]
=
i
*
8
+
j
a
[
i
][
j
]
=
i
*
8
+
j
...
...
tests/memoryview/memoryview.pyx
View file @
7a787e18
...
@@ -958,7 +958,7 @@ def test_contig_scalar_to_slice_assignment():
...
@@ -958,7 +958,7 @@ def test_contig_scalar_to_slice_assignment():
14 14 14 14
14 14 14 14
20 20 20 20
20 20 20 20
"""
"""
cdef
int
a
[
5
][
10
]
cdef
int
[
5
][
10
]
a
cdef
int
[:,
::
1
]
_m
=
a
cdef
int
[:,
::
1
]
_m
=
a
m
=
_m
m
=
_m
...
...
tests/memoryview/memslice.pyx
View file @
7a787e18
...
@@ -1322,7 +1322,7 @@ cdef class TestIndexSlicingDirectIndirectDims(object):
...
@@ -1322,7 +1322,7 @@ cdef class TestIndexSlicingDirectIndirectDims(object):
cdef
Py_ssize_t
[
3
]
shape
,
strides
,
suboffsets
cdef
Py_ssize_t
[
3
]
shape
,
strides
,
suboffsets
cdef
int
c_array
[
5
]
cdef
int
[
5
]
c_array
cdef
int
*
myarray
[
5
][
5
]
cdef
int
*
myarray
[
5
][
5
]
cdef
bytes
format
cdef
bytes
format
...
@@ -1647,8 +1647,8 @@ def test_memslice_struct_with_arrays():
...
@@ -1647,8 +1647,8 @@ def test_memslice_struct_with_arrays():
abc
abc
abc
abc
"""
"""
cdef
ArrayStruct
a1
[
10
]
cdef
ArrayStruct
[
10
]
a1
cdef
PackedArrayStruct
a2
[
10
]
cdef
PackedArrayStruct
[
10
]
a2
test_structs_with_arr
(
a1
)
test_structs_with_arr
(
a1
)
test_structs_with_arr
(
a2
)
test_structs_with_arr
(
a2
)
...
@@ -1760,14 +1760,14 @@ def test_padded_structs():
...
@@ -1760,14 +1760,14 @@ def test_padded_structs():
"""
"""
>>> test_padded_structs()
>>> test_padded_structs()
"""
"""
cdef
ArrayStruct
a1
[
10
]
cdef
ArrayStruct
[
10
]
a1
cdef
PackedArrayStruct
a2
[
10
]
cdef
PackedArrayStruct
[
10
]
a2
cdef
AlignedNested
a3
[
10
]
cdef
AlignedNested
[
10
]
a3
cdef
AlignedNestedNormal
a4
[
10
]
cdef
AlignedNestedNormal
[
10
]
a4
cdef
A
a5
[
10
]
cdef
A
[
10
]
a5
cdef
B
a6
[
10
]
cdef
B
[
10
]
a6
cdef
C
a7
[
10
]
cdef
C
[
10
]
a7
cdef
D
a8
[
10
]
cdef
D
[
10
]
a8
_test_padded
(
a1
)
_test_padded
(
a1
)
_test_padded
(
a2
)
_test_padded
(
a2
)
...
@@ -1794,7 +1794,7 @@ def test_object_indices():
...
@@ -1794,7 +1794,7 @@ def test_object_indices():
1
1
2
2
"""
"""
cdef
int
array
[
3
]
cdef
int
[
3
]
array
cdef
int
[:]
myslice
=
array
cdef
int
[:]
myslice
=
array
cdef
int
j
cdef
int
j
...
@@ -1835,7 +1835,7 @@ def test_slice_assignment():
...
@@ -1835,7 +1835,7 @@ def test_slice_assignment():
"""
"""
>>> test_slice_assignment()
>>> test_slice_assignment()
"""
"""
cdef
int
carray
[
10
][
100
]
cdef
int
[
10
][
100
]
carray
cdef
int
i
,
j
cdef
int
i
,
j
for
i
in
range
(
10
):
for
i
in
range
(
10
):
...
@@ -1864,8 +1864,8 @@ def test_slice_assignment_broadcast_leading():
...
@@ -1864,8 +1864,8 @@ def test_slice_assignment_broadcast_leading():
"""
"""
>>> test_slice_assignment_broadcast_leading()
>>> test_slice_assignment_broadcast_leading()
"""
"""
cdef
int
array1
[
1
][
10
]
cdef
int
[
1
][
10
]
array1
cdef
int
array2
[
10
]
cdef
int
[
10
]
array2
cdef
int
i
cdef
int
i
for
i
in
range
(
10
):
for
i
in
range
(
10
):
...
@@ -1896,8 +1896,8 @@ def test_slice_assignment_broadcast_strides():
...
@@ -1896,8 +1896,8 @@ def test_slice_assignment_broadcast_strides():
"""
"""
>>> test_slice_assignment_broadcast_strides()
>>> test_slice_assignment_broadcast_strides()
"""
"""
cdef
int
src_array
[
10
]
cdef
int
[
10
]
src_array
cdef
int
dst_array
[
10
][
5
]
cdef
int
[
10
][
5
]
dst_array
cdef
int
i
,
j
cdef
int
i
,
j
for
i
in
range
(
10
):
for
i
in
range
(
10
):
...
@@ -2046,7 +2046,7 @@ def test_scalar_slice_assignment():
...
@@ -2046,7 +2046,7 @@ def test_scalar_slice_assignment():
cdef
int
[
10
]
a
cdef
int
[
10
]
a
cdef
int
[:]
m
=
a
cdef
int
[:]
m
=
a
cdef
int
a2
[
5
][
10
]
cdef
int
[
5
][
10
]
a2
cdef
int
[:,
::
1
]
m2
=
a2
cdef
int
[:,
::
1
]
m2
=
a2
_test_scalar_slice_assignment
(
m
,
m2
)
_test_scalar_slice_assignment
(
m
,
m2
)
...
@@ -2102,7 +2102,7 @@ def test_contig_scalar_to_slice_assignment():
...
@@ -2102,7 +2102,7 @@ def test_contig_scalar_to_slice_assignment():
14 14 14 14
14 14 14 14
20 20 20 20
20 20 20 20
"""
"""
cdef
int
a
[
5
][
10
]
cdef
int
[
5
][
10
]
a
cdef
int
[:,
::
1
]
m
=
a
cdef
int
[:,
::
1
]
m
=
a
m
[...]
=
14
m
[...]
=
14
...
...
tests/memoryview/numpy_memoryview.pyx
View file @
7a787e18
...
@@ -296,28 +296,28 @@ def test_coerce_to_numpy():
...
@@ -296,28 +296,28 @@ def test_coerce_to_numpy():
#
#
### First set up some C arrays that will be used to hold data
### First set up some C arrays that will be used to hold data
#
#
cdef
MyStruct
mystructs
[
20
]
cdef
MyStruct
[
20
]
mystructs
cdef
SmallStruct
smallstructs
[
20
]
cdef
SmallStruct
[
20
]
smallstructs
cdef
NestedStruct
nestedstructs
[
20
]
cdef
NestedStruct
[
20
]
nestedstructs
cdef
PackedStruct
packedstructs
[
20
]
cdef
PackedStruct
[
20
]
packedstructs
cdef
signed
char
chars
[
20
]
cdef
signed
char
[
20
]
chars
cdef
short
shorts
[
20
]
cdef
short
[
20
]
shorts
cdef
int
ints
[
20
]
cdef
int
[
20
]
ints
cdef
long
long
longlongs
[
20
]
cdef
long
long
[
20
]
longlongs
cdef
td_h_short
externs
[
20
]
cdef
td_h_short
[
20
]
externs
cdef
float
floats
[
20
]
cdef
float
[
20
]
floats
cdef
double
doubles
[
20
]
cdef
double
[
20
]
doubles
cdef
long
double
longdoubles
[
20
]
cdef
long
double
[
20
]
longdoubles
cdef
float
complex
floatcomplex
[
20
]
cdef
float
complex
[
20
]
floatcomplex
cdef
double
complex
doublecomplex
[
20
]
cdef
double
complex
[
20
]
doublecomplex
cdef
long
double
complex
longdoublecomplex
[
20
]
cdef
long
double
complex
[
20
]
longdoublecomplex
cdef
td_h_short
h_shorts
[
20
]
cdef
td_h_short
[
20
]
h_shorts
cdef
td_h_double
h_doubles
[
20
]
cdef
td_h_double
[
20
]
h_doubles
cdef
td_h_ushort
h_ushorts
[
20
]
cdef
td_h_ushort
[
20
]
h_ushorts
cdef
Py_ssize_t
idx
=
17
cdef
Py_ssize_t
idx
=
17
...
@@ -586,7 +586,7 @@ cdef getbuffer(Buffer self, Py_buffer *info):
...
@@ -586,7 +586,7 @@ cdef getbuffer(Buffer self, Py_buffer *info):
info
.
format
=
self
.
format
info
.
format
=
self
.
format
cdef
class
Buffer
(
object
):
cdef
class
Buffer
(
object
):
cdef
Py_ssize_t
_shape
[
2
]
cdef
Py_ssize_t
[
2
]
_shape
cdef
bytes
format
cdef
bytes
format
cdef
float
[:,
:]
m
cdef
float
[:,
:]
m
cdef
object
shape
,
strides
cdef
object
shape
,
strides
...
@@ -667,4 +667,4 @@ def test_null_strides_error(buffer_obj):
...
@@ -667,4 +667,4 @@ def test_null_strides_error(buffer_obj):
try
:
try
:
fortran_buf2
=
buffer_obj
fortran_buf2
=
buffer_obj
except
ValueError
,
e
:
except
ValueError
,
e
:
print
e
print
e
\ No newline at end of file
tests/run/carray_slicing.pyx
View file @
7a787e18
...
@@ -153,7 +153,7 @@ def slice_charptr_for_loop_c_enumerate():
...
@@ -153,7 +153,7 @@ def slice_charptr_for_loop_c_enumerate():
############################################################
############################################################
# tests for int* slicing
# tests for int* slicing
cdef
int
cints
[
6
]
cdef
int
[
6
]
cints
for
i
in
range
(
6
):
for
i
in
range
(
6
):
cints
[
i
]
=
i
cints
[
i
]
=
i
...
@@ -207,7 +207,7 @@ def slice_intptr_for_loop_c():
...
@@ -207,7 +207,7 @@ def slice_intptr_for_loop_c():
############################################################
############################################################
# tests for slicing other arrays
# tests for slicing other arrays
cdef
double
cdoubles
[
6
]
cdef
double
[
6
]
cdoubles
for
i
in
range
(
6
):
for
i
in
range
(
6
):
cdoubles
[
i
]
=
i
+
0.5
cdoubles
[
i
]
=
i
+
0.5
...
@@ -267,7 +267,7 @@ def struct_ptr_iter():
...
@@ -267,7 +267,7 @@ def struct_ptr_iter():
>>> struct_ptr_iter()
>>> struct_ptr_iter()
([0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4])
([0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4])
"""
"""
cdef
MyStruct
my_structs
[
5
]
cdef
MyStruct
[
5
]
my_structs
for
i
in
range
(
5
):
for
i
in
range
(
5
):
my_structs
[
i
].
i
=
i
my_structs
[
i
].
i
=
i
cdef
MyStruct
value
cdef
MyStruct
value
...
...
tests/run/carrays.pyx
View file @
7a787e18
...
@@ -3,7 +3,7 @@ def test1():
...
@@ -3,7 +3,7 @@ def test1():
>>> test1()
>>> test1()
2
2
"""
"""
cdef
int
x
[
2
][
2
]
cdef
int
[
2
][
2
]
x
x
[
0
][
0
]
=
1
x
[
0
][
0
]
=
1
x
[
0
][
1
]
=
2
x
[
0
][
1
]
=
2
x
[
1
][
0
]
=
3
x
[
1
][
0
]
=
3
...
@@ -19,7 +19,7 @@ def test2():
...
@@ -19,7 +19,7 @@ def test2():
>>> test2()
>>> test2()
0
0
"""
"""
cdef
int
a1
[
5
]
cdef
int
[
5
]
a1
cdef
int
a2
[
2
+
3
]
cdef
int
a2
[
2
+
3
]
return
sizeof
(
a1
)
-
sizeof
(
a2
)
return
sizeof
(
a1
)
-
sizeof
(
a2
)
...
...
tests/run/cdef_function_kwargs.pyx
View file @
7a787e18
...
@@ -195,7 +195,7 @@ def varargs():
...
@@ -195,7 +195,7 @@ def varargs():
>>> print(varargs())
>>> print(varargs())
abc
abc
"""
"""
cdef char
buffer[10]
cdef char
[10] buffer
retval = snprintf(buffer, template="abc", size=10)
retval = snprintf(buffer, template="abc", size=10)
if retval < 0:
if retval < 0:
raise MemoryError()
raise MemoryError()
...
...
tests/run/cdefassign.pyx
View file @
7a787e18
...
@@ -7,7 +7,8 @@ def test(x, int y):
...
@@ -7,7 +7,8 @@ def test(x, int y):
"""
"""
if
True
:
if
True
:
before
=
0
before
=
0
cdef
int
a
=
4
,
b
=
x
,
c
=
y
,
*
p
=
&
y
cdef
int
a
=
4
,
b
=
x
,
c
=
y
cdef
int
*
p
=
&
y
cdef
object
o
=
int
(
8
)
cdef
object
o
=
int
(
8
)
print
a
,
b
,
c
,
p
[
0
],
before
,
g
,
o
print
a
,
b
,
c
,
p
[
0
],
before
,
g
,
o
...
...
tests/run/charencoding.pyx
View file @
7a787e18
...
@@ -23,7 +23,7 @@ else:
...
@@ -23,7 +23,7 @@ else:
"""
"""
def
test_assign
():
def
test_assign
():
cdef
char
s
[
17
]
cdef
char
[
17
]
s
s
[
0
]
=
c
'
\
x10
'
s
[
0
]
=
c
'
\
x10
'
s
[
1
]
=
c
'
\
x21
'
s
[
1
]
=
c
'
\
x21
'
...
...
tests/run/charescape.pyx
View file @
7a787e18
...
@@ -11,7 +11,7 @@ else:
...
@@ -11,7 +11,7 @@ else:
"""
"""
def
test
():
def
test
():
cdef
char
s
[
50
]
cdef
char
[
50
]
s
s
[
0
]
=
c
'
\
0
'
s
[
0
]
=
c
'
\
0
'
s
[
1
]
=
c
'
\
x01
'
s
[
1
]
=
c
'
\
x01
'
...
...
tests/run/coercearraytoptr.pyx
View file @
7a787e18
...
@@ -16,7 +16,7 @@ def eggs():
...
@@ -16,7 +16,7 @@ def eggs():
>>> print(str(eggs()).replace("b'", "'"))
>>> print(str(eggs()).replace("b'", "'"))
('abcdefg', 'abcdefg')
('abcdefg', 'abcdefg')
"""
"""
cdef
char
silly
[
42
]
cdef
char
[
42
]
silly
cdef
Grail
grail
cdef
Grail
grail
spam
(
silly
)
spam
(
silly
)
spam
(
grail
.
silly
)
spam
(
grail
.
silly
)
...
...
tests/run/cpp_stl_string.pyx
View file @
7a787e18
...
@@ -83,7 +83,7 @@ def test_copy(char *a):
...
@@ -83,7 +83,7 @@ def test_copy(char *a):
True
True
"""
"""
cdef
string
t
=
string
(
a
)
cdef
string
t
=
string
(
a
)
cdef
char
buffer
[
6
]
cdef
char
[
6
]
buffer
cdef
size_t
length
=
t
.
copy
(
buffer
,
4
,
1
)
cdef
size_t
length
=
t
.
copy
(
buffer
,
4
,
1
)
buffer
[
length
]
=
c
'
\
0
'
buffer
[
length
]
=
c
'
\
0
'
return
buffer
return
buffer
...
...
tests/run/cvardef.pyx
View file @
7a787e18
...
@@ -15,8 +15,8 @@ def f():
...
@@ -15,8 +15,8 @@ def f():
cdef
char
*
a_char_ptr
,
*
another_char_ptr
cdef
char
*
a_char_ptr
,
*
another_char_ptr
cdef
char
**
a_char_ptr_ptr
cdef
char
**
a_char_ptr_ptr
cdef
char
***
a_char_ptr_ptr_ptr
cdef
char
***
a_char_ptr_ptr_ptr
cdef
char
a_sized_char_array
[
10
]
cdef
char
[
10
]
a_sized_char_array
cdef
char
a_2d_char_array
[
10
][
20
]
cdef
char
[
10
][
20
]
a_2d_char_array
cdef
char
*
a_2d_char_ptr_array
[
10
][
20
]
cdef
char
*
a_2d_char_ptr_array
[
10
][
20
]
cdef
char
**
a_2d_char_ptr_ptr_array
[
10
][
20
]
cdef
char
**
a_2d_char_ptr_ptr_array
[
10
][
20
]
cdef
int
(
*
a_0arg_function
)()
cdef
int
(
*
a_0arg_function
)()
...
...
tests/run/cython_includes.pyx
View file @
7a787e18
...
@@ -9,7 +9,7 @@ def libc_cimports():
...
@@ -9,7 +9,7 @@ def libc_cimports():
>>> libc_cimports()
>>> libc_cimports()
hello
hello
"""
"""
cdef
char
buf
[
10
]
cdef
char
[
10
]
buf
sprintf
(
buf
,
"%s"
,
b'hello'
)
sprintf
(
buf
,
"%s"
,
b'hello'
)
print
(
<
object
>
buf
).
decode
(
'ASCII'
)
print
(
<
object
>
buf
).
decode
(
'ASCII'
)
...
...
tests/run/dietachmayer1.pyx
View file @
7a787e18
...
@@ -3,6 +3,6 @@ def test():
...
@@ -3,6 +3,6 @@ def test():
>>> test()
>>> test()
1.0
1.0
"""
"""
cdef
float
v
[
10
][
10
]
cdef
float
[
10
][
10
]
v
v
[
1
][
2
]
=
1.0
v
[
1
][
2
]
=
1.0
return
v
[
1
][
2
]
return
v
[
1
][
2
]
tests/run/enumerate_T316.pyx
View file @
7a787e18
...
@@ -62,7 +62,7 @@ def c_enumerate_carray_target():
...
@@ -62,7 +62,7 @@ def c_enumerate_carray_target():
3 4
3 4
"""
"""
cdef
int
k
cdef
int
k
cdef
int
i
[
1
]
cdef
int
[
1
]
i
for
i
[
0
],
k
in
enumerate
(
range
(
1
,
5
)):
for
i
[
0
],
k
in
enumerate
(
range
(
1
,
5
)):
print
i
[
0
],
k
print
i
[
0
],
k
...
...
tests/run/fused_types.pyx
View file @
7a787e18
...
@@ -94,10 +94,10 @@ def test_fused_with_pointer():
...
@@ -94,10 +94,10 @@ def test_fused_with_pointer():
breakfast
breakfast
humptydumptyfallsplatchbreakfast
humptydumptyfallsplatchbreakfast
"""
"""
cdef
int
int_array
[
5
]
cdef
int
[
5
]
int_array
cdef
long
long_array
[
5
]
cdef
long
[
5
]
long_array
cdef
float
float_array
[
5
]
cdef
float
[
5
]
float_array
cdef
string_t
string_array
[
5
]
cdef
string_t
[
5
]
string_array
cdef
char
*
s
cdef
char
*
s
...
...
tests/run/inplace.pyx
View file @
7a787e18
...
@@ -111,7 +111,7 @@ def test_side_effects():
...
@@ -111,7 +111,7 @@ def test_side_effects():
a
[
side_effect
(
1
)]
+=
10
a
[
side_effect
(
1
)]
+=
10
a
[
c_side_effect
(
2
)]
+=
100
a
[
c_side_effect
(
2
)]
+=
100
cdef
int
i
cdef
int
i
cdef
int
b
[
5
]
cdef
int
[
5
]
b
for
i
from
0
<=
i
<
5
:
for
i
from
0
<=
i
<
5
:
b
[
i
]
=
i
b
[
i
]
=
i
b
[
side_effect
(
3
)]
+=
10
b
[
side_effect
(
3
)]
+=
10
...
...
tests/run/lepage_1.pyx
View file @
7a787e18
...
@@ -9,7 +9,7 @@ __doc__ = u"""
...
@@ -9,7 +9,7 @@ __doc__ = u"""
"""
"""
cdef
class
A
:
cdef
class
A
:
cdef
double
x
[
3
]
cdef
double
[
3
]
x
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
cdef
int
i
,
max
cdef
int
i
,
max
...
...
tests/run/memoryview_namespace_T775.pyx
View file @
7a787e18
cdef
int
data
[
10
]
cdef
int
[
10
]
data
cdef
int
[:]
myslice
=
data
cdef
int
[:]
myslice
=
data
def
test_memoryview_namespace
():
def
test_memoryview_namespace
():
...
...
tests/run/py_unicode_strings.pyx
View file @
7a787e18
...
@@ -17,7 +17,7 @@ ctypedef Py_UNICODE* LPWSTR
...
@@ -17,7 +17,7 @@ ctypedef Py_UNICODE* LPWSTR
cdef
unicode
uobj
=
u'unicode
\
u1234
'
cdef
unicode
uobj
=
u'unicode
\
u1234
'
cdef
unicode
uobj1
=
u'u'
cdef
unicode
uobj1
=
u'u'
cdef
Py_UNICODE
*
c_pu_str
=
u"unicode
\
u1234
"
cdef
Py_UNICODE
*
c_pu_str
=
u"unicode
\
u1234
"
cdef
Py_UNICODE
c_pu_arr
[
42
]
cdef
Py_UNICODE
[
42
]
c_pu_arr
cdef
LPWSTR
c_wstr
=
u"unicode
\
u1234
"
cdef
LPWSTR
c_wstr
=
u"unicode
\
u1234
"
cdef
Py_UNICODE
*
c_pu_empty
=
u""
cdef
Py_UNICODE
*
c_pu_empty
=
u""
cdef
char
*
c_empty
=
""
cdef
char
*
c_empty
=
""
...
...
tests/run/r_primes.pyx
View file @
7a787e18
...
@@ -4,7 +4,7 @@ def primes(int kmax):
...
@@ -4,7 +4,7 @@ def primes(int kmax):
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
"""
"""
cdef
int
n
,
k
,
i
cdef
int
n
,
k
,
i
cdef
int
p
[
1000
]
cdef
int
[
1000
]
p
result
=
[]
result
=
[]
if
kmax
>
1000
:
if
kmax
>
1000
:
kmax
=
1000
kmax
=
1000
...
...
tests/run/r_pythonapi.pyx
View file @
7a787e18
...
@@ -14,6 +14,6 @@ cdef extern from "string.h":
...
@@ -14,6 +14,6 @@ cdef extern from "string.h":
from
cpython
cimport
PyUnicode_DecodeUTF8
from
cpython
cimport
PyUnicode_DecodeUTF8
def
spam
():
def
spam
():
cdef
char
buf
[
12
]
cdef
char
[
12
]
buf
memcpy
(
buf
,
"Ftang
\
0
Ftang!"
,
sizeof
(
buf
))
memcpy
(
buf
,
"Ftang
\
0
Ftang!"
,
sizeof
(
buf
))
return
PyUnicode_DecodeUTF8
(
buf
,
sizeof
(
buf
),
NULL
)
return
PyUnicode_DecodeUTF8
(
buf
,
sizeof
(
buf
),
NULL
)
tests/run/setjmp.pyx
View file @
7a787e18
...
@@ -25,7 +25,7 @@ def nonzero(int x):
...
@@ -25,7 +25,7 @@ def nonzero(int x):
from
libc.string
cimport
strcpy
from
libc.string
cimport
strcpy
cdef
char
error_msg
[
256
]
cdef
char
[
256
]
error_msg
cdef
jmp_buf
error_ctx
cdef
jmp_buf
error_ctx
cdef
void
error
(
char
msg
[])
nogil
:
cdef
void
error
(
char
msg
[])
nogil
:
strcpy
(
error_msg
,
msg
)
strcpy
(
error_msg
,
msg
)
...
...
tests/run/type_inference.pyx
View file @
7a787e18
...
@@ -385,7 +385,7 @@ def loop_over_struct_ptr():
...
@@ -385,7 +385,7 @@ def loop_over_struct_ptr():
>>> print( loop_over_struct_ptr() )
>>> print( loop_over_struct_ptr() )
MyStruct
MyStruct
"""
"""
cdef
MyStruct
a_list
[
10
]
cdef
MyStruct
[
10
]
a_list
cdef
MyStruct
*
a_ptr
=
a_list
cdef
MyStruct
*
a_ptr
=
a_list
for
i
in
a_list
[:
10
]:
for
i
in
a_list
[:
10
]:
pass
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment