This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients mark.dickinson, martin.panter, r.david.murray, rhettinger, serhiy.storchaka, tim.peters, vstinner, xiang.zhang
Date 2017-02-21.03:19:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487647157.04.0.147072585854.issue27660@psf.upfronthosting.co.za>
In-reply-to
Content
It was a little mind-numbing to check this code, but it looks correct.

Please fix two nits for better readability.   For review purposes, it was nice to have changes stand-out, but for the final code I would like to combine the two comments and the two new_allocated assignments into a single comment and single assignment:

      /* The growth pattern is:  0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ...
         Note: new_allocated won't overflow because the largest possible value
               is PY_SSIZE_T_MAX * (9 / 8) + 6 which always fits in a size_t.
      */
     new_allocated = (size_t)newsize + (newsize >> 3) + (newsize < 9 ? 3 : 6);

Secondly, please rename the "size" variable to something like "num_allocated_bytes".  It is confusing to have "newsize" mean the number of elements actually used while having "size" mean the number of bytes actually allocated (including the overallocation).
History
Date User Action Args
2017-02-21 03:19:17rhettingersetrecipients: + rhettinger, tim.peters, mark.dickinson, vstinner, r.david.murray, martin.panter, serhiy.storchaka, xiang.zhang
2017-02-21 03:19:17rhettingersetmessageid: <1487647157.04.0.147072585854.issue27660@psf.upfronthosting.co.za>
2017-02-21 03:19:17rhettingerlinkissue27660 messages
2017-02-21 03:19:16rhettingercreate