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
dbf409fb
Commit
dbf409fb
authored
Mar 18, 2002
by
Neil Schemenauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-enable GC of iter objects.
parent
d1648378
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
Objects/iterobject.c
Objects/iterobject.c
+12
-14
No files found.
Objects/iterobject.c
View file @
dbf409fb
...
@@ -12,22 +12,21 @@ PyObject *
...
@@ -12,22 +12,21 @@ PyObject *
PySeqIter_New
(
PyObject
*
seq
)
PySeqIter_New
(
PyObject
*
seq
)
{
{
seqiterobject
*
it
;
seqiterobject
*
it
;
it
=
PyObject_
NEW
(
seqiterobject
,
&
PySeqIter_Type
);
it
=
PyObject_
GC_New
(
seqiterobject
,
&
PySeqIter_Type
);
if
(
it
==
NULL
)
if
(
it
==
NULL
)
return
NULL
;
return
NULL
;
it
->
it_index
=
0
;
it
->
it_index
=
0
;
Py_INCREF
(
seq
);
Py_INCREF
(
seq
);
it
->
it_seq
=
seq
;
it
->
it_seq
=
seq
;
PyObject_GC_Init
(
it
);
_PyObject_GC_TRACK
(
it
);
return
(
PyObject
*
)
it
;
return
(
PyObject
*
)
it
;
}
}
static
void
static
void
iter_dealloc
(
seqiterobject
*
it
)
iter_dealloc
(
seqiterobject
*
it
)
{
{
PyObject_GC_Fini
(
it
);
_PyObject_GC_UNTRACK
(
it
);
Py_DECREF
(
it
->
it_seq
);
Py_DECREF
(
it
->
it_seq
);
it
=
(
seqiterobject
*
)
PyObject_AS_GC
(
it
);
PyObject_GC_Del
(
it
);
PyObject_DEL
(
it
);
}
}
static
int
static
int
...
@@ -100,7 +99,7 @@ PyTypeObject PySeqIter_Type = {
...
@@ -100,7 +99,7 @@ PyTypeObject PySeqIter_Type = {
PyObject_HEAD_INIT
(
&
PyType_Type
)
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
/* ob_size */
0
,
/* ob_size */
"iterator"
,
/* tp_name */
"iterator"
,
/* tp_name */
sizeof
(
seqiterobject
)
+
PyGC_HEAD_SIZE
,
/* tp_basicsize */
sizeof
(
seqiterobject
)
,
/* tp_basicsize */
0
,
/* tp_itemsize */
0
,
/* tp_itemsize */
/* methods */
/* methods */
(
destructor
)
iter_dealloc
,
/* tp_dealloc */
(
destructor
)
iter_dealloc
,
/* tp_dealloc */
...
@@ -118,7 +117,7 @@ PyTypeObject PySeqIter_Type = {
...
@@ -118,7 +117,7 @@ PyTypeObject PySeqIter_Type = {
PyObject_GenericGetAttr
,
/* tp_getattro */
PyObject_GenericGetAttr
,
/* tp_getattro */
0
,
/* tp_setattro */
0
,
/* tp_setattro */
0
,
/* tp_as_buffer */
0
,
/* tp_as_buffer */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_
GC
,
/* tp_flags */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_
HAVE_GC
,
/* tp_flags */
0
,
/* tp_doc */
0
,
/* tp_doc */
(
traverseproc
)
iter_traverse
,
/* tp_traverse */
(
traverseproc
)
iter_traverse
,
/* tp_traverse */
0
,
/* tp_clear */
0
,
/* tp_clear */
...
@@ -147,24 +146,23 @@ PyObject *
...
@@ -147,24 +146,23 @@ PyObject *
PyCallIter_New
(
PyObject
*
callable
,
PyObject
*
sentinel
)
PyCallIter_New
(
PyObject
*
callable
,
PyObject
*
sentinel
)
{
{
calliterobject
*
it
;
calliterobject
*
it
;
it
=
PyObject_
NEW
(
calliterobject
,
&
PyCallIter_Type
);
it
=
PyObject_
GC_New
(
calliterobject
,
&
PyCallIter_Type
);
if
(
it
==
NULL
)
if
(
it
==
NULL
)
return
NULL
;
return
NULL
;
Py_INCREF
(
callable
);
Py_INCREF
(
callable
);
it
->
it_callable
=
callable
;
it
->
it_callable
=
callable
;
Py_INCREF
(
sentinel
);
Py_INCREF
(
sentinel
);
it
->
it_sentinel
=
sentinel
;
it
->
it_sentinel
=
sentinel
;
PyObject_GC_Init
(
it
);
_PyObject_GC_TRACK
(
it
);
return
(
PyObject
*
)
it
;
return
(
PyObject
*
)
it
;
}
}
static
void
static
void
calliter_dealloc
(
calliterobject
*
it
)
calliter_dealloc
(
calliterobject
*
it
)
{
{
PyObject_GC_Fini
(
it
);
_PyObject_GC_UNTRACK
(
it
);
Py_DECREF
(
it
->
it_callable
);
Py_DECREF
(
it
->
it_callable
);
Py_DECREF
(
it
->
it_sentinel
);
Py_DECREF
(
it
->
it_sentinel
);
it
=
(
calliterobject
*
)
PyObject_AS_GC
(
it
);
PyObject_GC_Del
(
it
);
PyObject_DEL
(
it
);
}
}
static
int
static
int
...
@@ -218,7 +216,7 @@ PyTypeObject PyCallIter_Type = {
...
@@ -218,7 +216,7 @@ PyTypeObject PyCallIter_Type = {
PyObject_HEAD_INIT
(
&
PyType_Type
)
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
/* ob_size */
0
,
/* ob_size */
"callable-iterator"
,
/* tp_name */
"callable-iterator"
,
/* tp_name */
sizeof
(
calliterobject
)
+
PyGC_HEAD_SIZE
,
/* tp_basicsize */
sizeof
(
calliterobject
)
,
/* tp_basicsize */
0
,
/* tp_itemsize */
0
,
/* tp_itemsize */
/* methods */
/* methods */
(
destructor
)
calliter_dealloc
,
/* tp_dealloc */
(
destructor
)
calliter_dealloc
,
/* tp_dealloc */
...
@@ -236,7 +234,7 @@ PyTypeObject PyCallIter_Type = {
...
@@ -236,7 +234,7 @@ PyTypeObject PyCallIter_Type = {
PyObject_GenericGetAttr
,
/* tp_getattro */
PyObject_GenericGetAttr
,
/* tp_getattro */
0
,
/* tp_setattro */
0
,
/* tp_setattro */
0
,
/* tp_as_buffer */
0
,
/* tp_as_buffer */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_
GC
,
/* tp_flags */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_
HAVE_GC
,
/* tp_flags */
0
,
/* tp_doc */
0
,
/* tp_doc */
(
traverseproc
)
calliter_traverse
,
/* tp_traverse */
(
traverseproc
)
calliter_traverse
,
/* tp_traverse */
0
,
/* tp_clear */
0
,
/* tp_clear */
...
...
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