summaryrefslogtreecommitdiff
path: root/Python/asdl.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-11-23 15:56:41 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2014-11-23 15:56:41 +0100
commit7b53f4ba313ddc97503a1b20a32c7ece98e6f14f (patch)
treed4a1ae925557271361d6681d52110a9baab414f8 /Python/asdl.c
parent45d2905e417a1edcec07d77bb7a2b5e16a6d7a85 (diff)
parent86a6e9bbd9773fe387dae31f7ca24ccfcdc7ded1 (diff)
downloadcpython-7b53f4ba313ddc97503a1b20a32c7ece98e6f14f.tar.gz
Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures.
Diffstat (limited to 'Python/asdl.c')
-rw-r--r--Python/asdl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/asdl.c b/Python/asdl.c
index 74fa9410e4..df387b2119 100644
--- a/Python/asdl.c
+++ b/Python/asdl.c
@@ -5,21 +5,21 @@ asdl_seq *
_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena)
{
asdl_seq *seq = NULL;
- size_t n = (size ? (sizeof(void *) * (size - 1)) : 0);
+ size_t n;
/* check size is sane */
- if (size < 0 || size == INT_MIN ||
- (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) {
+ if (size < 0 ||
+ (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) {
PyErr_NoMemory();
return NULL;
}
+ n = (size ? (sizeof(void *) * (size - 1)) : 0);
/* 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);
@@ -36,21 +36,21 @@ asdl_int_seq *
_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)
{
asdl_int_seq *seq = NULL;
- size_t n = (size ? (sizeof(void *) * (size - 1)) : 0);
+ size_t n;
/* check size is sane */
- if (size < 0 || size == INT_MIN ||
- (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) {
+ if (size < 0 ||
+ (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) {
PyErr_NoMemory();
return NULL;
}
+ n = (size ? (sizeof(void *) * (size - 1)) : 0);
/* 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);