Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
001f228f
Commit
001f228f
authored
Nov 08, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the reverse list iterator to free memory as soon as the iterator
is exhausted.
parent
e21f6066
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
Objects/listobject.c
Objects/listobject.c
+4
-1
No files found.
Objects/listobject.c
View file @
001f228f
...
...
@@ -2771,7 +2771,7 @@ PyTypeObject PyListIter_Type = {
typedef
struct
{
PyObject_HEAD
long
it_index
;
PyListObject
*
it_seq
;
PyListObject
*
it_seq
;
/* Set to NULL when iterator is exhausted */
}
listreviterobject
;
PyTypeObject
PyListRevIter_Type
;
...
...
@@ -2819,6 +2819,9 @@ listreviter_next(listreviterobject *it)
item
=
PyList_GET_ITEM
(
it
->
it_seq
,
it
->
it_index
);
it
->
it_index
--
;
Py_INCREF
(
item
);
}
else
if
(
it
->
it_seq
!=
NULL
)
{
Py_DECREF
(
it
->
it_seq
);
it
->
it_seq
=
NULL
;
}
return
item
;
}
...
...
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