]> granicus.if.org Git - python/commitdiff
upcast int to size_t to silence two autological-constant-out-of-range-compare warning...
authorChristian Heimes <christian@cheimes.de>
Wed, 4 Dec 2013 07:42:46 +0000 (08:42 +0100)
committerChristian Heimes <christian@cheimes.de>
Wed, 4 Dec 2013 07:42:46 +0000 (08:42 +0100)
Parser/node.c
Python/compile.c

index b26ce61c015aa9cac17802ee1e34bf8cbfcf8ec0..564bd91fe575fe4d3fde70491fa41b91f46104d9 100644 (file)
@@ -91,7 +91,7 @@ PyNode_AddChild(node *n1, int type, char *str, int lineno, int col_offset)
     if (current_capacity < 0 || required_capacity < 0)
         return E_OVERFLOW;
     if (current_capacity < required_capacity) {
-        if (required_capacity > PY_SIZE_MAX / sizeof(node)) {
+        if ((size_t)required_capacity > PY_SIZE_MAX / sizeof(node)) {
             return E_NOMEM;
         }
         n = n1->n_child;
index 0fc91864fff02b92bc2ebe95d7c033fed21e0828..a7ddc5a11ac220e0072835eeb78ff3b9249dba3a 100644 (file)
@@ -3899,7 +3899,7 @@ assemble_init(struct assembler *a, int nblocks, int firstlineno)
     a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE);
     if (!a->a_lnotab)
         return 0;
-    if (nblocks > PY_SIZE_MAX / sizeof(basicblock *)) {
+    if ((size_t)nblocks > PY_SIZE_MAX / sizeof(basicblock *)) {
         PyErr_NoMemory();
         return 0;
     }