Added optional delay argument to FileHandler and subclasses.
[python.git] / Python / asdl.c
blob72329b9d2f26e7161b1c833854006b4f8df6e2e5
1 #include "Python.h"
2 #include "asdl.h"
4 asdl_seq *
5 asdl_seq_new(int size, PyArena *arena)
7 asdl_seq *seq = NULL;
8 size_t n = sizeof(asdl_seq) +
9 (size ? (sizeof(void *) * (size - 1)) : 0);
11 seq = (asdl_seq *)PyArena_Malloc(arena, n);
12 if (!seq) {
13 PyErr_NoMemory();
14 return NULL;
16 memset(seq, 0, n);
17 seq->size = size;
18 return seq;
21 asdl_int_seq *
22 asdl_int_seq_new(int size, PyArena *arena)
24 asdl_int_seq *seq = NULL;
25 size_t n = sizeof(asdl_seq) +
26 (size ? (sizeof(int) * (size - 1)) : 0);
28 seq = (asdl_int_seq *)PyArena_Malloc(arena, n);
29 if (!seq) {
30 PyErr_NoMemory();
31 return NULL;
33 memset(seq, 0, n);
34 seq->size = size;
35 return seq;