From 3ad50acc15e642fcf1fdecbb620bc72d0fcfbca0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 23 Sep 2020 12:59:48 +0200 Subject: [PATCH] bpo-40941: Fix fold_tuple_on_constants() compiler warnings Add explicit casts to fix compiler warnings in fold_tuple_on_constants(). --- Python/compile.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 3ebf221cf02b71..0f9e5c276c7b7b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -6100,13 +6100,11 @@ fold_tuple_on_constants(struct instr *inst, PyTuple_SET_ITEM(newconst, i, constant); } Py_ssize_t index = PyList_GET_SIZE(consts); -#if SIZEOF_SIZE_T > SIZEOF_INT - if ((size_t)index >= UINT_MAX - 1) { + if ((size_t)index >= (size_t)INT_MAX - 1) { Py_DECREF(newconst); PyErr_SetString(PyExc_OverflowError, "too many constants"); return -1; } -#endif if (PyList_Append(consts, newconst)) { Py_DECREF(newconst); return -1; @@ -6116,7 +6114,7 @@ fold_tuple_on_constants(struct instr *inst, inst[i].i_opcode = NOP; } inst[n].i_opcode = LOAD_CONST; - inst[n].i_oparg = index; + inst[n].i_oparg = (int)index; return 0; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy