Skip to content

Commit eff4a06

Browse files
committed
update comment
1 parent 67e25c4 commit eff4a06

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Objects/typeobject.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6420,16 +6420,18 @@ void
64206420
_PyType_SetFlagsRecursive(PyTypeObject *self, unsigned long mask, unsigned long flags)
64216421
{
64226422
BEGIN_TYPE_LOCK();
6423-
/* Invalidate the old version before changing flags. This must happen
6424-
before types_stop_world(); immutable/static-builtin types are
6425-
skipped because set_flags_recursive() does not touch them. */
6423+
/* Ideally, changing flags and invalidating the old version tag would
6424+
happen in one step. But type_modified_unlocked() is re-entrant and
6425+
cannot run with the world stopped, so we must invalidate first.
6426+
Immutable/static-builtin types are skipped because
6427+
set_flags_recursive() does not modify them. */
64266428
if (!PyType_HasFeature(self, Py_TPFLAGS_IMMUTABLETYPE) &&
64276429
(self->tp_flags & mask) != flags)
64286430
{
64296431
type_modified_unlocked(self);
64306432
}
6431-
/* Keep TYPE_LOCK held while waiting for stop-the-world so no thread
6432-
can reassign a version tag before the flag update. */
6433+
/* Keep TYPE_LOCK held while waiting for stop-the-world so no thread
6434+
can reassign a version tag before the flag update. */
64336435
type_lock_prevent_release();
64346436
types_stop_world();
64356437
set_flags_recursive(self, mask, flags);

0 commit comments

Comments
 (0)