Kaydet (Commit) 730f5535 authored tarafından Tim Peters's avatar Tim Peters

s/referrents/referents/g. Gotta love that referrers remains rife with rs.

üst 0f81ab6d
......@@ -99,9 +99,9 @@ objects, call \function{collect()} before calling
\versionadded{2.2}
\end{funcdesc}
\begin{funcdesc}{get_referrents}{*objs}
\begin{funcdesc}{get_referents}{*objs}
Return a list of objects directly referred to by any of the arguments.
The referrents returned are those objects visited by the arguments'
The referents returned are those objects visited by the arguments'
C-level \cfunction{tp_traverse} methods (if any), and may not be all
objects actually directly reachable. \cfunction{tp_traverse} methods
are supported only by objects that support garbage collection, and are
......
......@@ -304,28 +304,28 @@ def test_boom2():
expect(gc.collect(), 4, "boom2")
expect(len(gc.garbage), garbagelen, "boom2")
def test_get_referrents():
def test_get_referents():
alist = [1, 3, 5]
got = gc.get_referrents(alist)
got = gc.get_referents(alist)
got.sort()
expect(got, alist, "get_referrents")
expect(got, alist, "get_referents")
atuple = tuple(alist)
got = gc.get_referrents(atuple)
got = gc.get_referents(atuple)
got.sort()
expect(got, alist, "get_referrents")
expect(got, alist, "get_referents")
adict = {1: 3, 5: 7}
expected = [1, 3, 5, 7]
got = gc.get_referrents(adict)
got = gc.get_referents(adict)
got.sort()
expect(got, expected, "get_referrents")
expect(got, expected, "get_referents")
got = gc.get_referrents([1, 2], {3: 4}, (0, 0, 0))
got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0))
got.sort()
expect(got, [0, 0] + range(5), "get_referrents")
expect(got, [0, 0] + range(5), "get_referents")
expect(gc.get_referrents(1, 'a', 4j), [], "get_referrents")
expect(gc.get_referents(1, 'a', 4j), [], "get_referents")
def test_all():
gc.collect() # Delete 2nd generation garbage
......@@ -347,7 +347,7 @@ def test_all():
run_test("trashcan", test_trashcan)
run_test("boom", test_boom)
run_test("boom2", test_boom2)
run_test("get_referrents", test_get_referrents)
run_test("get_referents", test_get_referents)
def test():
if verbose:
......
......@@ -49,7 +49,7 @@ Core and builtins
Extension modules
-----------------
- New function gc.get_referrents(obj) returns a list of objects
- New function gc.get_referents(obj) returns a list of objects
directly referenced by obj. In effect, it exposes what the object's
tp_traverse slot does, and can be helpful when debugging memory
leaks.
......
......@@ -859,17 +859,17 @@ gc_get_referrers(PyObject *self, PyObject *args)
/* Append obj to list; return true if error (out of memory), false if OK. */
static int
referrentsvisit(PyObject *obj, PyObject *list)
referentsvisit(PyObject *obj, PyObject *list)
{
return PyList_Append(list, obj) < 0;
}
PyDoc_STRVAR(gc_get_referrents__doc__,
"get_referrents(*objs) -> list\n\
PyDoc_STRVAR(gc_get_referents__doc__,
"get_referents(*objs) -> list\n\
Return the list of objects that are directly referred to by objs.");
static PyObject *
gc_get_referrents(PyObject *self, PyObject *args)
gc_get_referents(PyObject *self, PyObject *args)
{
int i;
PyObject *result = PyList_New(0);
......@@ -886,7 +886,7 @@ gc_get_referrents(PyObject *self, PyObject *args)
traverse = obj->ob_type->tp_traverse;
if (! traverse)
continue;
if (traverse(obj, (visitproc)referrentsvisit, result)) {
if (traverse(obj, (visitproc)referentsvisit, result)) {
Py_DECREF(result);
return NULL;
}
......@@ -932,7 +932,7 @@ PyDoc_STRVAR(gc__doc__,
"get_threshold() -- Return the current the collection thresholds.\n"
"get_objects() -- Return a list of all objects tracked by the collector.\n"
"get_referrers() -- Return the list of objects that refer to an object.\n"
"get_referrents() -- Return the list of objects that an object refers to.\n");
"get_referents() -- Return the list of objects that an object refers to.\n");
static PyMethodDef GcMethods[] = {
{"enable", gc_enable, METH_NOARGS, gc_enable__doc__},
......@@ -946,8 +946,8 @@ static PyMethodDef GcMethods[] = {
{"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,
gc_get_referrents__doc__},
{"get_referents", gc_get_referents, METH_VARARGS,
gc_get_referents__doc__},
{NULL, NULL} /* Sentinel */
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment