From 730f5535ba8abf62ed580dcd605ec9a5de85d71b Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 8 Apr 2003 17:17:17 +0000 Subject: s/referrents/referents/g. Gotta love that referrers remains rife with rs. --- Doc/lib/libgc.tex | 4 ++-- Lib/test/test_gc.py | 22 +++++++++++----------- Misc/NEWS | 2 +- Modules/gcmodule.c | 16 ++++++++-------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Doc/lib/libgc.tex b/Doc/lib/libgc.tex index eea8d8c..51af5ad 100644 --- a/Doc/lib/libgc.tex +++ b/Doc/lib/libgc.tex @@ -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 diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index f0d5e19..0f99ef8 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -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: diff --git a/Misc/NEWS b/Misc/NEWS index 7b8f8c0..3ded09e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -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. diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index b0faad2..4fd4027 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -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 */ }; -- cgit v0.12