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
3ef3ee7f
Commit
3ef3ee7f
authored
Nov 09, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add another straight exception case to macros
parent
c7ff800a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
3 deletions
+44
-3
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+6
-3
tests/run/index.pyx
tests/run/index.pyx
+38
-0
No files found.
Cython/Utility/ObjectHandling.c
View file @
3ef3ee7f
...
...
@@ -250,7 +250,8 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), NULL) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
{{
for
type
in
[
'
List
'
,
'
Tuple
'
]}}
#define __Pyx_GetItemInt_{{type}}(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
...
...
@@ -343,7 +344,8 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) : \
__Pyx_SetItemInt_Generic(o, to_py_func(i), v))
(is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) : \
__Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static
CYTHON_INLINE
int
__Pyx_SetItemInt_Generic
(
PyObject
*
o
,
PyObject
*
j
,
PyObject
*
v
);
static
CYTHON_INLINE
int
__Pyx_SetItemInt_Fast
(
PyObject
*
o
,
Py_ssize_t
i
,
PyObject
*
v
,
...
...
@@ -408,7 +410,8 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje
#define __Pyx_DelItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_DelItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound) : \
__Pyx_DelItem_Generic(o, to_py_func(i)))
(is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) : \
__Pyx_DelItem_Generic(o, to_py_func(i))))
static
CYTHON_INLINE
int
__Pyx_DelItem_Generic
(
PyObject
*
o
,
PyObject
*
j
);
static
CYTHON_INLINE
int
__Pyx_DelItemInt_Fast
(
PyObject
*
o
,
Py_ssize_t
i
,
...
...
tests/run/index.pyx
View file @
3ef3ee7f
...
...
@@ -75,6 +75,44 @@ def index_object(object o, int i):
return
o
[
i
]
def
del_index_list
(
list
L
,
Py_ssize_t
index
):
"""
>>> del_index_list(list(range(4)), 0)
[1, 2, 3]
>>> del_index_list(list(range(4)), 1)
[0, 2, 3]
>>> del_index_list(list(range(4)), -1)
[0, 1, 2]
>>> del_index_list(list(range(4)), py_maxsize)
Traceback (most recent call last):
IndexError: list assignment index out of range
>>> del_index_list(list(range(4)), -py_maxsize)
Traceback (most recent call last):
IndexError: list assignment index out of range
"""
del
L
[
index
]
return
L
def
set_index_list
(
list
L
,
Py_ssize_t
index
):
"""
>>> set_index_list(list(range(4)), 0)
[5, 1, 2, 3]
>>> set_index_list(list(range(4)), 1)
[0, 5, 2, 3]
>>> set_index_list(list(range(4)), -1)
[0, 1, 2, 5]
>>> set_index_list(list(range(4)), py_maxsize)
Traceback (most recent call last):
IndexError: list assignment index out of range
>>> set_index_list(list(range(4)), -py_maxsize)
Traceback (most recent call last):
IndexError: list assignment index out of range
"""
L
[
index
]
=
5
return
L
# These make sure that our fast indexing works with large and unsigned types.
def
test_unsigned_long
():
...
...
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