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
25361fb6
Commit
25361fb6
authored
Dec 04, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sizeof(my_fused_type)
parent
d467658e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
tests/run/fused_types.pyx
tests/run/fused_types.pyx
+7
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
25361fb6
...
@@ -7049,6 +7049,8 @@ class SizeofVarNode(SizeofNode):
...
@@ -7049,6 +7049,8 @@ class SizeofVarNode(SizeofNode):
operand_as_type
=
self
.
operand
.
analyse_as_type
(
env
)
operand_as_type
=
self
.
operand
.
analyse_as_type
(
env
)
if
operand_as_type
:
if
operand_as_type
:
self
.
arg_type
=
operand_as_type
self
.
arg_type
=
operand_as_type
if
self
.
arg_type
.
is_fused
:
self
.
arg_type
=
self
.
arg_type
.
specialize
(
env
.
fused_to_specific
)
self
.
__class__
=
SizeofTypeNode
self
.
__class__
=
SizeofTypeNode
self
.
check_type
()
self
.
check_type
()
else
:
else
:
...
...
tests/run/fused_types.pyx
View file @
25361fb6
...
@@ -242,3 +242,10 @@ def test_fused_declarations(cython.integral i, cython.floating f):
...
@@ -242,3 +242,10 @@ def test_fused_declarations(cython.integral i, cython.floating f):
print
cython
.
typeof
(
squared_int
)
print
cython
.
typeof
(
squared_int
)
print
cython
.
typeof
(
squared_float
)
print
cython
.
typeof
(
squared_float
)
print
'%d %.2f'
%
(
squared_int
,
squared_float
)
print
'%d %.2f'
%
(
squared_int
,
squared_float
)
def
test_sizeof_fused_type
(
fused_type1
b
):
"""
>>> test_sizeof_fused_type[pure_cython.double](11.1)
"""
t
=
sizeof
(
b
),
sizeof
(
fused_type1
),
sizeof
(
double
)
assert
t
[
0
]
==
t
[
1
]
==
t
[
2
],
t
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