@@ -715,8 +715,9 @@ static int handle_weakrefs(PyGC_Head* unreachable, PyGC_Head* old) {
715715 _PyWeakref_ClearRef ((PyWeakReference * )op );
716716 }
717717
718- if (!PyType_SUPPORTS_WEAKREFS (Py_TYPE (op )))
718+ if (!PyType_SUPPORTS_WEAKREFS (Py_TYPE (op ))) {
719719 continue ;
720+ }
720721
721722 /* It supports weakrefs. Does it have any? */
722723 wrlist = (PyWeakReference * * )_PyObject_GET_WEAKREFS_LISTPTR (op );
@@ -804,10 +805,11 @@ static int handle_weakrefs(PyGC_Head* unreachable, PyGC_Head* old) {
804805
805806 /* copy-paste of weakrefobject.c's handle_callback() */
806807 temp = PyObject_CallOneArg (callback , (PyObject * )wr );
807- if (temp == NULL )
808+ if (temp == NULL ) {
808809 PyErr_WriteUnraisable (callback );
809- else
810+ } else {
810811 Py_DECREF (temp );
812+ }
811813
812814 /* Give up the reference we created in the first pass. When
813815 * op's refcount hits 0 (which it may or may not do right now),
@@ -1130,10 +1132,12 @@ static Py_ssize_t gc_collect_main(
11301132 }
11311133
11321134 /* update collection and allocation counters */
1133- if (generation + 1 < NUM_GENERATIONS )
1135+ if (generation + 1 < NUM_GENERATIONS ) {
11341136 gcstate -> generations [generation + 1 ].count += 1 ;
1135- for (i = 0 ; i <= generation ; i ++ )
1137+ }
1138+ for (i = 0 ; i <= generation ; i ++ ) {
11361139 gcstate -> generations [i ].count = 0 ;
1140+ }
11371141
11381142 /* merge younger generations with one we are currently collecting */
11391143 for (i = 0 ; i < generation ; i ++ ) {
@@ -1142,10 +1146,11 @@ static Py_ssize_t gc_collect_main(
11421146
11431147 /* handy references */
11441148 young = GEN_HEAD (gcstate , generation );
1145- if (generation < NUM_GENERATIONS - 1 )
1149+ if (generation < NUM_GENERATIONS - 1 ) {
11461150 old = GEN_HEAD (gcstate , generation + 1 );
1147- else
1151+ } else {
11481152 old = young ;
1153+ }
11491154 validate_list (old , collecting_clear_unreachable_clear );
11501155
11511156 Ci_ParGCState * par_gc = (Ci_ParGCState * )gc_impl ;
@@ -1219,8 +1224,9 @@ static Py_ssize_t gc_collect_main(
12191224 * debugging information. */
12201225 for (gc = GC_NEXT (& finalizers ); gc != & finalizers ; gc = GC_NEXT (gc )) {
12211226 n ++ ;
1222- if (gcstate -> debug & DEBUG_UNCOLLECTABLE )
1227+ if (gcstate -> debug & DEBUG_UNCOLLECTABLE ) {
12231228 debug_cycle ("uncollectable" , FROM_GC (gc ));
1229+ }
12241230 }
12251231 if (gcstate -> debug & DEBUG_STATS ) {
12261232 PyTime_t t2 = 0 ;
0 commit comments