Skip to content

Commit 6f461ed

Browse files
committed
address review
1 parent a651c44 commit 6f461ed

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Objects/typeobject.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6066,14 +6066,16 @@ void
60666066
_PyType_SetFlagsRecursive(PyTypeObject *self, unsigned long mask, unsigned long flags)
60676067
{
60686068
BEGIN_TYPE_LOCK();
6069-
/* Invalidate the old version first so
6070-
readers cannot assign a fresh tag from stale flags. */
6069+
/* Ideally, changing flags and invalidating the old version tag would happen
6070+
in one step. In 3.14, invalidate first while holding TYPE_LOCK so readers
6071+
cannot assign a fresh tag from stale flags. Immutable types are skipped by
6072+
set_flags_recursive(). */
60716073
if (!PyType_HasFeature(self, Py_TPFLAGS_IMMUTABLETYPE) &&
60726074
(self->tp_flags & mask) != flags)
60736075
{
60746076
type_modified_unlocked(self);
6075-
set_flags_recursive(self, mask, flags);
60766077
}
6078+
set_flags_recursive(self, mask, flags);
60776079
END_TYPE_LOCK();
60786080
}
60796081

0 commit comments

Comments
 (0)