Re: [Python-Dev] [Python-checkins] cpython (3.4): Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer

2015年2月16日 13:18:34 -0800

2015年02月16日 17:34 GMT+01:00 Stefan Krah <[email protected]>:
>
> On Mon, Feb 16, 2015 at 11:35:52AM +0000, serhiy.storchaka wrote:
>> diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
>> --- a/Modules/_testbuffer.c
>> +++ b/Modules/_testbuffer.c
>> @@ -850,7 +850,7 @@
>> Py_ssize_t *dest;
>> Py_ssize_t x, i;
>>
>> - dest = PyMem_Malloc(len * (sizeof *dest));
>> + dest = PyMem_New(Py_ssize_t, len);
>> if (dest == NULL) {
>> PyErr_NoMemory();
>> return NULL;
>
> This, too, was already protected by len == ndim <= 64.
I don't understand why you don't want to use PyMem_New() even if it
cannot overflow. PyMem_New() is more readable no?
Victor
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to