A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-February/138331.html below:

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

[Python-Dev] [Python-checkins] cpython (3.4): Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer [Python-Dev] [Python-checkins] cpython (3.4): Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integerVictor Stinner victor.stinner at gmail.com
Mon Feb 16 22:14:59 CET 2015
2015-02-16 17:34 GMT+01:00 Stefan Krah <stefan at bytereef.org>:
>
> 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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4