bpo-36389: Cleanup gc.set_threshold() (GH-12844) · python/cpython@0810fa7

Original file line numberDiff line numberDiff line change

@@ -1374,7 +1374,7 @@ gc_set_thresh(PyObject *self, PyObject *args)

13741374

&_PyRuntime.gc.generations[1].threshold,

13751375

&_PyRuntime.gc.generations[2].threshold))

13761376

return NULL;

1377-

for (i = 2; i < NUM_GENERATIONS; i++) {

1377+

for (i = 3; i < NUM_GENERATIONS; i++) {

13781378

/* generations higher than 2 get the same threshold */

13791379

_PyRuntime.gc.generations[i].threshold = _PyRuntime.gc.generations[2].threshold;

13801380

}

@@ -1524,7 +1524,7 @@ gc_get_objects_impl(PyObject *module, Py_ssize_t generation)

15241524

}

15251525
15261526

/* If generation is passed, we extract only that generation */

1527-

if (generation != -1) {

1527+

if (generation != -1) {

15281528

if (generation >= NUM_GENERATIONS) {

15291529

PyErr_Format(PyExc_ValueError,

15301530

"generation parameter must be less than the number of "