From ba3e87f07a3f331cacb2c2579ca28538d45d2ba0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 11 Sep 2017 17:06:45 +0200 Subject: [PATCH] bpo-30860: Fix deadcode in obmalloc.c Fix Coverity CID 1417587: _PyMem_Initialize() contains code which is never executed. Replace the runtime check with a build assertion. --- Objects/obmalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 57edf97e2064e5..f2651d7574b20f 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -297,9 +297,9 @@ _PyMem_Initialize(struct _pymem_runtime_state *state) state->allocators.obj = _pyobject; #ifdef WITH_PYMALLOC + Py_BUILD_ASSERT(NB_SMALL_SIZE_CLASSES == 64); + for (int i = 0; i < 8; i++) { - if (NB_SMALL_SIZE_CLASSES <= i * 8) - break; for (int j = 0; j < 8; j++) { int x = i * 8 + j; poolp *addr = &(state->usedpools[2*(x)]);