[Python-checkins] Only count number of members once (#12691)

Dino Viehland webhook-mailer at python.org
Mon May 6 11:28:54 EDT 2019


https://github.com/python/cpython/commit/8b1271b12fdbb1ac01217d929d8b112119e3f53b
commit: 8b1271b12fdbb1ac01217d929d8b112119e3f53b
branch: master
author: Eddie Elizondo <eelizondo at fb.com>
committer: Dino Viehland <dinoviehland at gmail.com>
date: 2019-05-06T08:28:50-07:00
summary:

Only count number of members once (#12691)

files:
M Objects/typeobject.c

diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 37df4d23e4c1..eeaae1f9f789 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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++;
             }



More information about the Python-checkins mailing list