Staging
v0.5.1
v0.5.1
https://github.com/python/cpython
Revision b2c2a0c02c6056dc73311a8a8a295249c454913a authored by Miss Islington (bot) on 27 September 2019, 08:13:38 UTC, committed by GitHub on 27 September 2019, 08:13:38 UTC
(cherry picked from commit 6ce03ec627680ce0829a5b3067fab7faed21b533) Co-authored-by: HongWeipeng <961365124@qq.com>
1 parent 1931132
Tip revision: b2c2a0c02c6056dc73311a8a8a295249c454913a authored by Miss Islington (bot) on 27 September 2019, 08:13:38 UTC
cleanup ababstractproperty in typing.py (GH-16432)
cleanup ababstractproperty in typing.py (GH-16432)
Tip revision: b2c2a0c
asdl.c
#include "Python.h"
#include "asdl.h"
asdl_seq *
_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena)
{
asdl_seq *seq = NULL;
size_t n;
/* check size is sane */
if (size < 0 ||
(size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
PyErr_NoMemory();
return NULL;
}
n = (size ? (sizeof(void *) * (size - 1)) : 0);
/* check if size can be added safely */
if (n > SIZE_MAX - sizeof(asdl_seq)) {
PyErr_NoMemory();
return NULL;
}
n += sizeof(asdl_seq);
seq = (asdl_seq *)PyArena_Malloc(arena, n);
if (!seq) {
PyErr_NoMemory();
return NULL;
}
memset(seq, 0, n);
seq->size = size;
return seq;
}
asdl_int_seq *
_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)
{
asdl_int_seq *seq = NULL;
size_t n;
/* check size is sane */
if (size < 0 ||
(size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
PyErr_NoMemory();
return NULL;
}
n = (size ? (sizeof(void *) * (size - 1)) : 0);
/* check if size can be added safely */
if (n > SIZE_MAX - sizeof(asdl_seq)) {
PyErr_NoMemory();
return NULL;
}
n += sizeof(asdl_seq);
seq = (asdl_int_seq *)PyArena_Malloc(arena, n);
if (!seq) {
PyErr_NoMemory();
return NULL;
}
memset(seq, 0, n);
seq->size = size;
return seq;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...