Message 289310 - Python tracker (original) (raw)

So once these functions are decorated with this attribute, what kind of testing/validation you have in mind, please let me know.

Call PyMem_Malloc(Py_ssize_t) for example: it must emit a warning on GCC 7, since casting negative values to size_t overflows.

Not sure how to test the attribute on GCC 6. Maybe some GCC related static analyzers are able to detect memory leaks like:

void test(void) { void ptr = PyMem_Malloc(16); / don't free ptr */ }