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
de12778f
Commit
de12778f
authored
Nov 09, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work around stupid C compiler warnings about tests being always true due to integer ranges
parent
c9486f9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
7 deletions
+60
-7
Cython/Utility/TypeConversion.c
Cython/Utility/TypeConversion.c
+10
-7
tests/run/index.pyx
tests/run/index.pyx
+50
-0
No files found.
Cython/Utility/TypeConversion.c
View file @
de12778f
...
...
@@ -2,13 +2,16 @@
/* Type Conversion Predeclarations */
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
(sizeof(type) < sizeof(Py_ssize_t)) || \
(sizeof(type) > sizeof(Py_ssize_t) && \
likely(v <= (type)PY_SSIZE_T_MAX) && \
(!is_signed || likely(v >= (type)PY_SSIZE_T_MIN))) || \
(sizeof(type) == sizeof(Py_ssize_t) && \
(is_signed || likely(v <= (type)PY_SSIZE_T_MAX))) )
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
(sizeof(type) < sizeof(Py_ssize_t)) || \
(sizeof(type) > sizeof(Py_ssize_t) && \
likely(v < (type)PY_SSIZE_T_MAX || \
v == (type)PY_SSIZE_T_MAX) && \
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
v == (type)PY_SSIZE_T_MIN))) || \
(sizeof(type) == sizeof(Py_ssize_t) && \
(is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
v == (type)PY_SSIZE_T_MAX))) )
static
CYTHON_INLINE
char
*
__Pyx_PyObject_AsString
(
PyObject
*
);
static
CYTHON_INLINE
char
*
__Pyx_PyObject_AsStringAndSize
(
PyObject
*
,
Py_ssize_t
*
length
);
...
...
tests/run/index.pyx
View file @
de12778f
...
...
@@ -161,8 +161,58 @@ def test_long_long():
ix
=
(
<
long
long
>
1
)
<<
i
assert
D
[
ix
]
is
True
del
D
[
ix
]
L
=
[
1
,
2
,
3
]
try
:
ix
=
py_maxsize
+
1
except
OverflowError
:
pass
# can't test this here
else
:
try
:
L
[
ix
]
=
5
except
IndexError
:
pass
else
:
assert
False
,
"setting large index failed to raise IndexError"
try
:
del
L
[
ix
]
except
IndexError
:
pass
else
:
assert
False
,
"deleting large index failed to raise IndexError"
try
:
ix
=
-
py_maxsize
-
2
except
OverflowError
:
pass
# can't test this here
else
:
try
:
L
[
ix
]
=
5
except
IndexError
:
pass
else
:
assert
False
,
"setting large index failed to raise IndexError"
try
:
del
L
[
ix
]
except
IndexError
:
pass
else
:
assert
False
,
"deleting large index failed to raise IndexError"
assert
len
(
D
)
==
0
def
test_ulong_long
():
"""
>>> test_ulong_long()
"""
cdef
unsigned
long
long
ix
L
=
[
1
,
2
,
3
]
try
:
ix
=
py_maxsize
+
1
except
OverflowError
:
pass
# can't test this here
else
:
try
:
L
[
ix
]
=
5
except
IndexError
:
pass
else
:
assert
False
,
"setting large index failed to raise IndexError"
try
:
del
L
[
ix
]
except
IndexError
:
pass
else
:
assert
False
,
"deleting large index failed to raise IndexError"
@
cython
.
boundscheck
(
False
)
def
test_boundscheck_unsigned
(
list
L
,
tuple
t
,
object
o
,
unsigned
long
ix
):
"""
...
...
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