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
d45bf003
Commit
d45bf003
authored
Feb 16, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify pop() optimisation utility code
parent
61ab9c73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
19 deletions
+6
-19
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+6
-19
No files found.
Cython/Utility/Optimize.c
View file @
d45bf003
...
@@ -82,11 +82,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
...
@@ -82,11 +82,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
static
PyObject
*
__Pyx_PyObject_PopIndex
(
PyObject
*
L
,
Py_ssize_t
ix
);
/*proto*/
static
PyObject
*
__Pyx_PyObject_PopIndex
(
PyObject
*
L
,
Py_ssize_t
ix
);
/*proto*/
/////////////// pop_index ///////////////
/////////////// pop_index ///////////////
//@requires: ObjectHandling.c::PyObject
GetAttrStr
//@requires: ObjectHandling.c::PyObject
CallMethod
static
PyObject
*
__Pyx_PyObject_PopIndex
(
PyObject
*
L
,
Py_ssize_t
ix
)
{
static
PyObject
*
__Pyx_PyObject_PopIndex
(
PyObject
*
L
,
Py_ssize_t
ix
)
{
PyObject
*
r
,
*
m
,
*
t
,
*
py_ix
;
PyObject
*
r
,
*
py_ix
;
#if CYTHON_COMPILING_IN_CPYTHON
&& PY_VERSION_HEX >= 0x02040000
#if CYTHON_COMPILING_IN_CPYTHON
if
(
likely
(
PyList_CheckExact
(
L
)))
{
if
(
likely
(
PyList_CheckExact
(
L
)))
{
Py_ssize_t
size
=
PyList_GET_SIZE
(
L
);
Py_ssize_t
size
=
PyList_GET_SIZE
(
L
);
if
(
likely
(
size
>
(((
PyListObject
*
)
L
)
->
allocated
>>
1
)))
{
if
(
likely
(
size
>
(((
PyListObject
*
)
L
)
->
allocated
>>
1
)))
{
...
@@ -103,24 +103,11 @@ static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix) {
...
@@ -103,24 +103,11 @@ static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix) {
}
}
}
}
#endif
#endif
py_ix
=
t
=
NULL
;
m
=
__Pyx_PyObject_GetAttrStr
(
L
,
PYIDENT
(
"pop"
));
if
(
!
m
)
goto
bad
;
py_ix
=
PyInt_FromSsize_t
(
ix
);
py_ix
=
PyInt_FromSsize_t
(
ix
);
if
(
!
py_ix
)
goto
bad
;
if
(
!
py_ix
)
return
NULL
;
t
=
PyTuple_New
(
1
);
r
=
__Pyx_PyObject_CallMethod1
(
L
,
PYIDENT
(
"pop"
),
py_ix
);
if
(
!
t
)
goto
bad
;
Py_DECREF
(
py_ix
);
PyTuple_SET_ITEM
(
t
,
0
,
py_ix
);
py_ix
=
NULL
;
r
=
PyObject_CallObject
(
m
,
t
);
Py_DECREF
(
m
);
Py_DECREF
(
t
);
return
r
;
return
r
;
bad:
Py_XDECREF
(
m
);
Py_XDECREF
(
t
);
Py_XDECREF
(
py_ix
);
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