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
Boxiang Sun
cython
Commits
98487311
Commit
98487311
authored
Feb 26, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix builtins.memoryview affected tests in Py3.3
parent
2306b721
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
9 deletions
+33
-9
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView.pyx
+1
-1
tests/run/buffer.pyx
tests/run/buffer.pyx
+6
-2
tests/run/memslice.pyx
tests/run/memslice.pyx
+26
-6
No files found.
Cython/Utility/MemoryView.pyx
View file @
98487311
...
...
@@ -1439,7 +1439,7 @@ cdef format_from_typeinfo(__Pyx_TypeInfo *type):
while
field
.
type
:
part
=
format_from_typeinfo
(
field
.
type
).
decode
(
'ascii'
)
parts
.
append
(
'%s:%s:'
%
(
part
,
field
.
name
))
parts
.
append
(
'%s:%s:'
%
(
part
,
(
<
char
*>
field
.
name
).
decode
(
'ascii'
)
))
field
+=
1
result
=
alignment
.
join
(
parts
)
+
'}'
...
...
tests/run/buffer.pyx
View file @
98487311
...
...
@@ -12,13 +12,17 @@ b'abcdefg'
>>> m1 = memoryview(b1)
__getbuffer__ called
>>> m1.tobytes()
Semantics changed in python 3.3
>> m1.tobytes()
__getbuffer__ called
b'abcdefg'
>>> m2 = memoryview(b2)
__getbuffer__ called
>>> m2.tobytes()
Semantics changed in python 3.3
>> m2.tobytes()
__getbuffer__ called
releasing!
b'abcdefg'
...
...
tests/run/memslice.pyx
View file @
98487311
...
...
@@ -13,6 +13,12 @@ import gc
import
sys
import
re
if
sys
.
version_info
[
0
]
<
3
:
import
__builtin__
as
builtins
else
:
import
builtins
__test__
=
{}
def
testcase
(
func
):
...
...
@@ -1650,12 +1656,7 @@ cdef test_structs_with_arr(FusedStruct array[10]):
for
j
in
range
(
3
):
myslice1
[
i
].
chars
[
j
]
=
97
+
j
if
sys
.
version_info
[:
2
]
>=
(
2
,
7
):
if
sys
.
version_info
[
0
]
<
3
:
import
__builtin__
as
builtins
else
:
import
builtins
if
sys
.
version_info
[:
2
]
>=
(
2
,
7
)
and
sys
.
version_info
[:
2
]
<
(
3
,
3
):
size1
=
sizeof
(
FusedStruct
)
size2
=
len
(
builtins
.
memoryview
(
myslice1
)[
0
])
assert
size1
==
size2
,
(
size1
,
size2
,
builtins
.
memoryview
(
myslice1
).
format
)
...
...
@@ -1675,6 +1676,25 @@ cdef test_structs_with_arr(FusedStruct array[10]):
print
myslice1
[
0
].
chars
[:
3
].
decode
(
'ascii'
)
cdef
struct
TestAttrs
:
int
int_attrib
char
char_attrib
@
testcase
def
test_struct_attributes_format
():
"""
>>> test_struct_attributes_format()
T{i:int_attrib:b:char_attrib:}
"""
cdef
TestAttrs
[
10
]
array
cdef
TestAttrs
[:]
struct_memview
=
array
if
sys
.
version_info
[:
2
]
>=
(
2
,
7
):
print
builtins
.
memoryview
(
struct_memview
).
format
else
:
print
"T{i:int_attrib:b:char_attrib:}"
# Test padding at the end of structs in the buffer support
cdef
struct
PaddedAtEnd
:
int
a
[
3
]
...
...
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