Skip to content

Commit 7c2688f

Browse files
committed
Small update comments
1 parent d83ef20 commit 7c2688f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Include/objimpl.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,14 @@ extern PyGC_Head *_PyGC_generation0;
284284
#define _PyGC_FINALIZED(o) _PyGCHead_FINALIZED(_Py_AS_GC(o))
285285
#define _PyGC_SET_FINALIZED(o) _PyGCHead_SET_FINALIZED(_Py_AS_GC(o))
286286

287-
/* Tell the GC to track this object. NB: While the object is tracked the
288-
* collector it must be safe to call the ob_traverse method. */
287+
/* Tell the GC to track this object.
288+
*
289+
* NB: While the object is tracked the collector it must be safe to call the
290+
* ob_traverse method.
291+
*
292+
* 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.
294+
*/
289295
#define _PyObject_GC_TRACK(o) do { \
290296
PyGC_Head *g = _Py_AS_GC(o); \
291297
if (g->gc.gc_next != NULL) \
@@ -298,8 +304,9 @@ extern PyGC_Head *_PyGC_generation0;
298304
} while (0);
299305

300306
/* Tell the GC to stop tracking this object.
301-
* NOTE: This may be called while GC. So _PyGC_PREV_MASK_INTERNAL must be
302-
* cleared.
307+
*
308+
* Internal note: This may be called while GC. So _PyGC_PREV_MASK_INTERNAL must
309+
* be cleared. Only _PyGC_PREV_MASK_FINALIZED bit is kept.
303310
*/
304311
#define _PyObject_GC_UNTRACK(o) do { \
305312
PyGC_Head *g = _Py_AS_GC(o); \

Modules/gcmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define GC_DEBUG (0) /* More asserts */
3535

3636
// Bit 0 of gc_prev is used for _PyGC_PREV_MASK_FINALIZED in objimpl.h
37+
// These two mask bits are used only between GC.
3738
#define MASK_COLLECTING (1 << 1)
3839
#define MASK_TENTATIVELY_UNREACHABLE (1 << 2)
3940

0 commit comments

Comments
 (0)