File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments