New submission from STINNER Victor:

GCC allows to get "size" parameters of functions allocating memory to emit 
better warning. For example, GCC 7 will detect implicit cast from signed to 
unsigned integer and emit a warning.

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

Example of Python functions that can benefit of this attribute:

* PyMem_RawMalloc(), PyMem_RawCalloc(), PyMem_RawRealloc()
* PyMem_Malloc(), PyMem_Calloc(), PyMem_Realloc()
* PyObject_Malloc(), PyObject_Calloc(), PyObject_Realloc()

----------
messages: 288699
nosy: haypo
priority: normal
severity: normal
status: open
title: Use GCC __attribute__((alloc_size(x,y))) on PyMem_Malloc() functions
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29674>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to