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
13ab4d8a
Commit
13ab4d8a
authored
Nov 05, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify C helper code.
parent
58e771f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+15
-13
No files found.
Cython/Utility/ObjectHandling.c
View file @
13ab4d8a
...
...
@@ -276,21 +276,23 @@ static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* k
#if CYTHON_USE_TYPE_SLOTS
static
PyObject
*
__Pyx_PyObject_GetIndex
(
PyObject
*
obj
,
PyObject
*
index
)
{
PyObject
*
runerr
;
Py_ssize_t
key_value
;
PySequenceMethods
*
m
=
Py_TYPE
(
obj
)
->
tp_as_sequence
;
if
(
likely
(
m
&&
m
->
sq_item
))
{
PyObject
*
runerr
;
Py_ssize_t
key_value
=
__Pyx_PyIndex_AsSsize_t
(
index
);
if
(
likely
(
key_value
!=
-
1
||
!
(
runerr
=
PyErr_Occurred
())))
{
return
__Pyx_GetItemInt_Fast
(
obj
,
key_value
,
0
,
1
,
1
);
}
// Error handling code -- only manage OverflowError differently.
if
(
PyErr_GivenExceptionMatches
(
runerr
,
PyExc_OverflowError
))
{
PyErr_Clear
();
PyErr_Format
(
PyExc_IndexError
,
"cannot fit '%.200s' into an index-sized integer"
,
Py_TYPE
(
index
)
->
tp_name
);
}
}
else
{
if
(
unlikely
(
!
(
m
&&
m
->
sq_item
)))
{
PyErr_Format
(
PyExc_TypeError
,
"'%.200s' object is not subscriptable"
,
Py_TYPE
(
obj
)
->
tp_name
);
return
NULL
;
}
key_value
=
__Pyx_PyIndex_AsSsize_t
(
index
);
if
(
likely
(
key_value
!=
-
1
||
!
(
runerr
=
PyErr_Occurred
())))
{
return
__Pyx_GetItemInt_Fast
(
obj
,
key_value
,
0
,
1
,
1
);
}
// Error handling code -- only manage OverflowError differently.
if
(
PyErr_GivenExceptionMatches
(
runerr
,
PyExc_OverflowError
))
{
PyErr_Clear
();
PyErr_Format
(
PyExc_IndexError
,
"cannot fit '%.200s' into an index-sized integer"
,
Py_TYPE
(
index
)
->
tp_name
);
}
return
NULL
;
}
...
...
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