]> granicus.if.org Git - python/commitdiff
bpo-36389: Cleanup gc.set_threshold() (GH-12844)
authorVictor Stinner <vstinner@redhat.com>
Mon, 15 Apr 2019 15:54:09 +0000 (17:54 +0200)
committerGitHub <noreply@github.com>
Mon, 15 Apr 2019 15:54:09 +0000 (17:54 +0200)
Don't assign generations[2].threshold to generations[2].threshold:
useless operation.

Modules/gcmodule.c

index fad1356d6b443d40d6b8c09c0b2966f168717412..a75d5fed95f11e80a491834c0ef4ac090cb99f0e 100644 (file)
@@ -1374,7 +1374,7 @@ gc_set_thresh(PyObject *self, PyObject *args)
                           &_PyRuntime.gc.generations[1].threshold,
                           &_PyRuntime.gc.generations[2].threshold))
         return NULL;
-    for (i = 2; i < NUM_GENERATIONS; i++) {
+    for (i = 3; i < NUM_GENERATIONS; i++) {
         /* generations higher than 2 get the same threshold */
         _PyRuntime.gc.generations[i].threshold = _PyRuntime.gc.generations[2].threshold;
     }
@@ -1524,7 +1524,7 @@ gc_get_objects_impl(PyObject *module, Py_ssize_t generation)
     }
 
     /* If generation is passed, we extract only that generation */
-    if (generation != -1) { 
+    if (generation != -1) {
         if (generation >= NUM_GENERATIONS) {
             PyErr_Format(PyExc_ValueError,
                          "generation parameter must be less than the number of "