]> granicus.if.org Git - python/commitdiff
Only count number of members once (#12691)
authorEddie Elizondo <eelizondo@fb.com>
Mon, 6 May 2019 15:28:50 +0000 (11:28 -0400)
committerDino Viehland <dinoviehland@gmail.com>
Mon, 6 May 2019 15:28:50 +0000 (08:28 -0700)
Objects/typeobject.c

index 37df4d23e4c1927d7591937f92e2df6b8d97f768..eeaae1f9f789475c68a54c7a1dab22ad8bc0aaf1 100644 (file)
@@ -2895,6 +2895,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
     nmembers = 0;
     for (slot = spec->slots; slot->slot; slot++) {
         if (slot->slot == Py_tp_members) {
+            nmembers = 0;
             for (memb = slot->pfunc; memb->name != NULL; memb++) {
                 nmembers++;
             }