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
b13f8350
Commit
b13f8350
authored
Feb 17, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pop optimization for 2.3.
parent
0183ec9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+10
-8
No files found.
Cython/Compiler/Optimize.py
View file @
b13f8350
...
@@ -1621,20 +1621,20 @@ impl = ""
...
@@ -1621,20 +1621,20 @@ impl = ""
pop_utility_code
=
UtilityCode
(
pop_utility_code
=
UtilityCode
(
proto
=
"""
proto
=
"""
static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
#if PY_VERSION_HEX >= 0x02040000
if (likely(PyList_CheckExact(L))
if (likely(PyList_CheckExact(L))
/* Check that both the size is positive and no reallocation shrinking needs to be done. */
/* Check that both the size is positive and no reallocation shrinking needs to be done. */
&& likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
&& likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
Py_SIZE(L) -= 1;
Py_SIZE(L) -= 1;
return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
}
}
else {
#endif
PyObject *r, *m;
PyObject *r, *m;
m = __Pyx_GetAttrString(L, "pop");
m = __Pyx_GetAttrString(L, "pop");
if (!m) return NULL;
if (!m) return NULL;
r = PyObject_CallObject(m, NULL);
r = PyObject_CallObject(m, NULL);
Py_DECREF(m);
Py_DECREF(m);
return r;
return r;
}
}
}
"""
,
"""
,
impl
=
""
impl
=
""
...
@@ -1647,6 +1647,7 @@ static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix);
...
@@ -1647,6 +1647,7 @@ static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix);
impl
=
"""
impl
=
"""
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, *m, *t, *py_ix;
#if PY_VERSION_HEX >= 0x02040000
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))) {
...
@@ -1665,6 +1666,7 @@ static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix) {
...
@@ -1665,6 +1666,7 @@ static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix) {
}
}
}
}
}
}
#endif
py_ix = t = NULL;
py_ix = t = NULL;
m = __Pyx_GetAttrString(L, "pop");
m = __Pyx_GetAttrString(L, "pop");
if (!m) goto bad;
if (!m) goto bad;
...
...
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