Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 724b828

Browse files
committed
upcast int to size_t to silence two autological-constant-out-of-range-compare warnings with clang.
1 parent 7a934fb commit 724b828

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Parser/node.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ PyNode_AddChild(node *n1, int type, char *str, int lineno, int col_offset)
9191
if (current_capacity < 0 || required_capacity < 0)
9292
return E_OVERFLOW;
9393
if (current_capacity < required_capacity) {
94-
if (required_capacity > PY_SIZE_MAX / sizeof(node)) {
94+
if ((size_t)required_capacity > PY_SIZE_MAX / sizeof(node)) {
9595
return E_NOMEM;
9696
}
9797
n = n1->n_child;

Python/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3899,7 +3899,7 @@ assemble_init(struct assembler *a, int nblocks, int firstlineno)
38993899
a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE);
39003900
if (!a->a_lnotab)
39013901
return 0;
3902-
if (nblocks > PY_SIZE_MAX / sizeof(basicblock *)) {
3902+
if ((size_t)nblocks > PY_SIZE_MAX / sizeof(basicblock *)) {
39033903
PyErr_NoMemory();
39043904
return 0;
39053905
}

0 commit comments

Comments
 (0)