mirror of
https://github.com/python/cpython.git
synced 2024-11-24 17:47:13 +01:00
a829313d7b
Clarify intended use of set_context() and check errors at all call sites.
20 lines
346 B
C
20 lines
346 B
C
#include "Python.h"
|
|
#include "asdl.h"
|
|
|
|
asdl_seq *
|
|
asdl_seq_new(int size, PyArena *arena)
|
|
{
|
|
asdl_seq *seq = NULL;
|
|
size_t n = sizeof(asdl_seq) +
|
|
(size ? (sizeof(void *) * (size - 1)) : 0);
|
|
|
|
seq = (asdl_seq *)PyArena_Malloc(arena, n);
|
|
if (!seq) {
|
|
PyErr_NoMemory();
|
|
return NULL;
|
|
}
|
|
memset(seq, 0, n);
|
|
seq->size = size;
|
|
return seq;
|
|
}
|