Skip to content

Commit 34d4ffa

Browse files
committed
Format if statement and add comment
1 parent c02223e commit 34d4ffa

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Objects/typeobject.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6547,10 +6547,14 @@ type_setattro(PyObject *self, PyObject *name, PyObject *value)
65476547
assert(!_PyType_HasFeature(metatype, Py_TPFLAGS_MANAGED_DICT));
65486548

65496549
#ifdef Py_GIL_DISABLED
6550+
// gh-139103: Enable deferred refcounting for functions assigned
6551+
// to type objects. This is important for `dataclass.__init__`,
6552+
// which is generated dynamically.
65506553
if (value != NULL &&
65516554
PyFunction_Check(value) &&
6552-
!_PyObject_HasDeferredRefcount(value)) {
6553-
PyUnstable_Object_EnableDeferredRefcount(value);
6555+
!_PyObject_HasDeferredRefcount(value))
6556+
{
6557+
PyUnstable_Object_EnableDeferredRefcount(value);
65546558
}
65556559
#endif
65566560

0 commit comments

Comments
 (0)