[issue37200] PyType_GenericAlloc might over-allocate memory

2019-06-07 Thread Neil Schemenauer
Neil Schemenauer added the comment: Updated patch is attached. It appears that the extra item is only needed if Py_TPFLAGS_TYPE_SUBCLASS set. In all other cases, it seems we don't need the extra space for the sentinel. At least, the unit tests pass with this change. It could be that

[issue37200] PyType_GenericAlloc might over-allocate memory

2019-06-07 Thread Neil Schemenauer
New submission from Neil Schemenauer : In the process of working on some garbage collector/obmalloc experiments, I noticed what seems to be a quirk about PyType_GenericAlloc(). It calls: size = _PyObject_VAR_SIZE(type, nitems+1); Note the "+1" which is documented as "for the sentinel".