Skip to content

Commit 07329a8

Browse files
committed
Fix comments
1 parent 7c2688f commit 07329a8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Include/objimpl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,12 @@ extern PyGC_Head *_PyGC_generation0;
286286

287287
/* Tell the GC to track this object.
288288
*
289-
* NB: While the object is tracked the collector it must be safe to call the
289+
* NB: While the object is tracked by the collector, it must be safe to call the
290290
* ob_traverse method.
291291
*
292292
* Internal note: _PyGC_generation0->gc.gc_prev doesn't have any bit flags
293-
* because it's not object header. Wo we skip using _PyGCHead_SET_PREV() here.
293+
* because it's not object header. That's why we don't use _PyGCHead_SET_PREV()
294+
* for it.
294295
*/
295296
#define _PyObject_GC_TRACK(o) do { \
296297
PyGC_Head *g = _Py_AS_GC(o); \

Modules/gcmodule.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#define MASK_COLLECTING (1 << 1)
3939
#define MASK_TENTATIVELY_UNREACHABLE (1 << 2)
4040

41-
#define IS_TRACKED(o) (_Py_AS_GC(o)->gc.gc_next != NULL)
4241
#define IS_TENTATIVELY_UNREACHABLE(o) ( \
4342
(_Py_AS_GC(o)->gc.gc_prev & MASK_TENTATIVELY_UNREACHABLE) != 0)
4443

@@ -294,8 +293,8 @@ validate_list(PyGC_Head *head, uintptr_t expected_mask)
294293
/*** end of list stuff ***/
295294

296295

297-
/* Set all gc_refs = ob_refcnt. After this, gc_refs is > 0 for all objects
298-
* in containers.
296+
/* Set all gc_refs = ob_refcnt. After this, gc_refs is > 0 and
297+
* MASK_COLLECTING bit is set for all objects in containers.
299298
*/
300299
static void
301300
update_refs(PyGC_Head *containers)
@@ -1496,7 +1495,7 @@ gc_is_tracked(PyObject *module, PyObject *obj)
14961495
{
14971496
PyObject *result;
14981497

1499-
if (PyObject_IS_GC(obj) && IS_TRACKED(obj))
1498+
if (PyObject_IS_GC(obj) && _PyObject_GC_IS_TRACKED(obj))
15001499
result = Py_True;
15011500
else
15021501
result = Py_False;

0 commit comments

Comments
 (0)