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
50c61d5a
Commit
50c61d5a
authored
Apr 06, 2003
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched from METH_VARARGS to METH_NOARGS for the 7 module functions that
take no arguments; cuts generated code size.
parent
bf384c25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
44 deletions
+17
-44
Modules/gcmodule.c
Modules/gcmodule.c
+17
-44
No files found.
Modules/gcmodule.c
View file @
50c61d5a
...
...
@@ -633,7 +633,7 @@ collect(int generation)
/* Collect statistics on uncollectable objects found and print
* debugging information. */
for
(
gc
=
finalizers
.
gc
.
gc_next
;
for
(
gc
=
finalizers
.
gc
.
gc_next
;
gc
!=
&
finalizers
;
gc
=
gc
->
gc
.
gc_next
)
{
n
++
;
...
...
@@ -699,14 +699,9 @@ PyDoc_STRVAR(gc_enable__doc__,
"Enable automatic garbage collection.
\n
"
);
static
PyObject
*
gc_enable
(
PyObject
*
self
,
PyObject
*
args
)
gc_enable
(
PyObject
*
self
,
PyObject
*
no
args
)
{
if
(
!
PyArg_ParseTuple
(
args
,
":enable"
))
/* check no args */
return
NULL
;
enabled
=
1
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
...
...
@@ -717,14 +712,9 @@ PyDoc_STRVAR(gc_disable__doc__,
"Disable automatic garbage collection.
\n
"
);
static
PyObject
*
gc_disable
(
PyObject
*
self
,
PyObject
*
args
)
gc_disable
(
PyObject
*
self
,
PyObject
*
no
args
)
{
if
(
!
PyArg_ParseTuple
(
args
,
":disable"
))
/* check no args */
return
NULL
;
enabled
=
0
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
...
...
@@ -735,12 +725,8 @@ PyDoc_STRVAR(gc_isenabled__doc__,
"Returns true if automatic garbage collection is enabled.
\n
"
);
static
PyObject
*
gc_isenabled
(
PyObject
*
self
,
PyObject
*
args
)
gc_isenabled
(
PyObject
*
self
,
PyObject
*
no
args
)
{
if
(
!
PyArg_ParseTuple
(
args
,
":isenabled"
))
/* check no args */
return
NULL
;
return
Py_BuildValue
(
"i"
,
enabled
);
}
...
...
@@ -750,16 +736,12 @@ PyDoc_STRVAR(gc_collect__doc__,
"Run a full collection. The number of unreachable objects is returned.
\n
"
);
static
PyObject
*
gc_collect
(
PyObject
*
self
,
PyObject
*
args
)
gc_collect
(
PyObject
*
self
,
PyObject
*
no
args
)
{
long
n
;
if
(
!
PyArg_ParseTuple
(
args
,
":collect"
))
/* check no args */
return
NULL
;
if
(
collecting
)
{
if
(
collecting
)
n
=
0
;
/* already collecting, don't do anything */
}
else
{
collecting
=
1
;
n
=
collect
(
NUM_GENERATIONS
-
1
);
...
...
@@ -801,11 +783,8 @@ PyDoc_STRVAR(gc_get_debug__doc__,
"Get the garbage collection debugging flags.
\n
"
);
static
PyObject
*
gc_get_debug
(
PyObject
*
self
,
PyObject
*
args
)
gc_get_debug
(
PyObject
*
self
,
PyObject
*
no
args
)
{
if
(
!
PyArg_ParseTuple
(
args
,
":get_debug"
))
/* no args */
return
NULL
;
return
Py_BuildValue
(
"i"
,
debug
);
}
...
...
@@ -839,11 +818,8 @@ PyDoc_STRVAR(gc_get_thresh__doc__,
"Return the current collection thresholds
\n
"
);
static
PyObject
*
gc_get_thresh
(
PyObject
*
self
,
PyObject
*
args
)
gc_get_thresh
(
PyObject
*
self
,
PyObject
*
no
args
)
{
if
(
!
PyArg_ParseTuple
(
args
,
":get_threshold"
))
/* no args */
return
NULL
;
return
Py_BuildValue
(
"(iii)"
,
generations
[
0
].
threshold
,
generations
[
1
].
threshold
,
...
...
@@ -948,17 +924,14 @@ append_objects(PyObject *py_list, PyGC_Head *gc_list)
}
static
PyObject
*
gc_get_objects
(
PyObject
*
self
,
PyObject
*
args
)
gc_get_objects
(
PyObject
*
self
,
PyObject
*
no
args
)
{
int
i
;
PyObject
*
result
;
if
(
!
PyArg_ParseTuple
(
args
,
":get_objects"
))
/* check no args */
return
NULL
;
result
=
PyList_New
(
0
);
if
(
result
==
NULL
)
{
if
(
result
==
NULL
)
return
NULL
;
}
for
(
i
=
0
;
i
<
NUM_GENERATIONS
;
i
++
)
{
if
(
append_objects
(
result
,
GEN_HEAD
(
i
)))
{
Py_DECREF
(
result
);
...
...
@@ -985,15 +958,15 @@ PyDoc_STRVAR(gc__doc__,
"get_referrents() -- Return the list of objects that an object refers to.
\n
"
);
static
PyMethodDef
GcMethods
[]
=
{
{
"enable"
,
gc_enable
,
METH_
VARARGS
,
gc_enable__doc__
},
{
"disable"
,
gc_disable
,
METH_
VARARGS
,
gc_disable__doc__
},
{
"isenabled"
,
gc_isenabled
,
METH_
VARARGS
,
gc_isenabled__doc__
},
{
"enable"
,
gc_enable
,
METH_
NOARGS
,
gc_enable__doc__
},
{
"disable"
,
gc_disable
,
METH_
NOARGS
,
gc_disable__doc__
},
{
"isenabled"
,
gc_isenabled
,
METH_
NOARGS
,
gc_isenabled__doc__
},
{
"set_debug"
,
gc_set_debug
,
METH_VARARGS
,
gc_set_debug__doc__
},
{
"get_debug"
,
gc_get_debug
,
METH_
VARARGS
,
gc_get_debug__doc__
},
{
"get_debug"
,
gc_get_debug
,
METH_
NOARGS
,
gc_get_debug__doc__
},
{
"set_threshold"
,
gc_set_thresh
,
METH_VARARGS
,
gc_set_thresh__doc__
},
{
"get_threshold"
,
gc_get_thresh
,
METH_
VARARGS
,
gc_get_thresh__doc__
},
{
"collect"
,
gc_collect
,
METH_
VARARGS
,
gc_collect__doc__
},
{
"get_objects"
,
gc_get_objects
,
METH_
VARARGS
,
gc_get_objects__doc__
},
{
"get_threshold"
,
gc_get_thresh
,
METH_
NOARGS
,
gc_get_thresh__doc__
},
{
"collect"
,
gc_collect
,
METH_
NOARGS
,
gc_collect__doc__
},
{
"get_objects"
,
gc_get_objects
,
METH_
NOARGS
,
gc_get_objects__doc__
},
{
"get_referrers"
,
gc_get_referrers
,
METH_VARARGS
,
gc_get_referrers__doc__
},
{
"get_referrents"
,
gc_get_referrents
,
METH_VARARGS
,
...
...
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