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
77fe9327
Commit
77fe9327
authored
Apr 16, 2018
by
Callie LeFave
Committed by
Stefan Behnel
Jul 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `fused_pointer_except_null` test undefined behavior
Signed-off-by:
Stefan Behnel
<
stefan_ml@behnel.de
>
parent
798f08ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
tests/run/fused_types.pyx
tests/run/fused_types.pyx
+10
-7
No files found.
tests/run/fused_types.pyx
View file @
77fe9327
...
...
@@ -119,12 +119,12 @@ def test_fused_with_pointer():
print
print
fused_with_pointer
(
string_array
).
decode
(
'ascii'
)
cdef
fused_type1
*
fused_pointer_except_null
(
fused_type1
x
)
except
NULL
:
cdef
fused_type1
*
fused_pointer_except_null
(
fused_type1
*
x
)
except
NULL
:
if
fused_type1
is
string_t
:
assert
(
bool
(
x
))
assert
(
bool
(
x
[
0
]
))
else
:
assert
(
x
<
10
)
return
&
x
assert
(
x
[
0
]
<
10
)
return
x
def
test_fused_pointer_except_null
(
value
):
"""
...
...
@@ -145,11 +145,14 @@ def test_fused_pointer_except_null(value):
AssertionError
"""
if
isinstance
(
value
,
int
):
print
fused_pointer_except_null
(
<
cython
.
int
>
value
)[
0
]
test_int
=
cython
.
declare
(
cython
.
int
,
value
)
print
fused_pointer_except_null
(
&
test_int
)[
0
]
elif
isinstance
(
value
,
float
):
print
fused_pointer_except_null
(
<
cython
.
float
>
value
)[
0
]
test_float
=
cython
.
declare
(
cython
.
float
,
value
)
print
fused_pointer_except_null
(
&
test_float
)[
0
]
elif
isinstance
(
value
,
bytes
):
print
fused_pointer_except_null
(
<
string_t
>
value
)[
0
].
decode
(
'ascii'
)
test_str
=
cython
.
declare
(
string_t
,
value
)
print
fused_pointer_except_null
(
&
test_str
)[
0
].
decode
(
'ascii'
)
include
"cythonarrayutil.pxi"
...
...
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