Mercurial > cpython-lru_cache-weakref
view Python/asdl.c @ 58689:514b56efd89a 3.1
Merged revisions 77962 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r77962 | r.david.murray | 2010-02-04 11:41:57 -0500 (Thu, 04 Feb 2010) | 17 lines
Merged revisions 77943,77959-77960 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77943 | r.david.murray | 2010-02-03 08:36:23 -0500 (Wed, 03 Feb 2010) | 2 lines
Explicitly mention the default value for formatdate's usegmt parameter.
........
r77959 | nick.coghlan | 2010-02-04 07:43:58 -0500 (Thu, 04 Feb 2010) | 1 line
Issue 6760: Clarify args handling for subprocess.Popen. Patch by Chris Rebert
........
r77960 | r.david.murray | 2010-02-04 11:33:31 -0500 (Thu, 04 Feb 2010) | 2 lines
Add Chris Rebert to ACKS for issue 6760 Popen doc improvements.
........
................
| author | R. David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Thu, 04 Feb 2010 16:44:31 +0000 |
| parents | ac854cde3135 |
| children | cab14be0ada1 |
line wrap: on
line source
#include "Python.h" #include "asdl.h" asdl_seq * asdl_seq_new(int size, PyArena *arena) { asdl_seq *seq = NULL; size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); /* check size is sane */ if (size < 0 || size == INT_MIN || (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } /* check if size can be added safely */ if (n > PY_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 * asdl_int_seq_new(int size, PyArena *arena) { asdl_int_seq *seq = NULL; size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); /* check size is sane */ if (size < 0 || size == INT_MIN || (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } /* check if size can be added safely */ if (n > PY_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; }
