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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
6e837884
Commit
6e837884
authored
May 17, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in new buffmt code
parent
c3fc785a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+6
-2
tests/run/buffmt.pyx
tests/run/buffmt.pyx
+4
-3
No files found.
Cython/Compiler/PyrexTypes.py
View file @
6e837884
...
@@ -1329,9 +1329,13 @@ class CStructOrUnionType(CType):
...
@@ -1329,9 +1329,13 @@ class CStructOrUnionType(CType):
return
self
.
is_complete
()
return
self
.
is_complete
()
def
can_be_complex
(
self
):
def
can_be_complex
(
self
):
# Does the struct consist of exactly two floats?
# Does the struct consist of exactly two
identical
floats?
fields
=
self
.
scope
.
var_entries
fields
=
self
.
scope
.
var_entries
return
len
(
fields
)
==
2
and
fields
[
0
].
type
.
is_float
and
fields
[
1
].
type
.
is_float
if
len
(
fields
)
!=
2
:
return
False
a
,
b
=
fields
return
(
a
.
type
.
is_float
and
b
.
type
.
is_float
and
a
.
type
.
declaration_code
(
""
)
==
b
.
type
.
declaration_code
(
""
))
def
struct_nesting_depth
(
self
):
def
struct_nesting_depth
(
self
):
child_depths
=
[
x
.
type
.
struct_nesting_depth
()
child_depths
=
[
x
.
type
.
struct_nesting_depth
()
...
...
tests/run/buffmt.pyx
View file @
6e837884
...
@@ -254,7 +254,7 @@ def int_and_long_are_same():
...
@@ -254,7 +254,7 @@ def int_and_long_are_same():
longarr
=
MockBuffer
(
"i"
,
sizeof
(
int
))
longarr
=
MockBuffer
(
"i"
,
sizeof
(
int
))
cdef
struct
MixedComplex
:
cdef
struct
MixedComplex
:
long
double
real
double
real
float
imag
float
imag
@
testcase
@
testcase
...
@@ -265,9 +265,10 @@ def mixed_complex_struct():
...
@@ -265,9 +265,10 @@ def mixed_complex_struct():
>>> mixed_complex_struct()
>>> mixed_complex_struct()
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ValueError: Buffer dtype mismatch, expected '
long
double' but got 'complex double' in 'MixedComplex.real'
ValueError: Buffer dtype mismatch, expected 'double' but got 'complex double' in 'MixedComplex.real'
"""
"""
cdef
object
[
MixedComplex
]
buf
=
MockBuffer
(
"Zd"
,
sizeof
(
MixedComplex
))
cdef
object
[
MixedComplex
]
buf
=
MockBuffer
(
"Zd"
,
sizeof
(
MixedComplex
))
cdef
packed
struct
PackedSubStruct
:
cdef
packed
struct
PackedSubStruct
:
...
...
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