Staging
v0.5.1
v0.5.1
https://github.com/python/cpython
Revision 7f7cd899e3d773b803b7af5b0c19eeff83dd69fe authored by Miss Islington (bot) on 23 September 2019, 23:16:53 UTC, committed by GitHub on 23 September 2019, 23:16:53 UTC
Refactor path configuration code: * read_pth_file() now returns PyStatus to report errors, rather than calling Py_FatalError(). * Move argv0_path and zip_path buffers out of PyCalculatePath structures. * On Windows, _PyPathConfig.home is now preferred over PyConfig.home. (cherry picked from commit 85ce0a7178801b538160cbb5cf9ef50a713c45bf) Co-authored-by: Victor Stinner <vstinner@redhat.com>
1 parent 3f5409a
Tip revision: 7f7cd899e3d773b803b7af5b0c19eeff83dd69fe authored by Miss Islington (bot) on 23 September 2019, 23:16:53 UTC
bpo-38234: read_pth_file() now returns PyStatus (GH-16338)
bpo-38234: read_pth_file() now returns PyStatus (GH-16338)
Tip revision: 7f7cd89
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 ...