Skip to content

Commit ccb3c76

Browse files
authored
bpo-30860: Fix deadcode in obmalloc.c (#3499)
Fix Coverity CID 1417587: _PyMem_Initialize() contains code which is never executed. Replace the runtime check with a build assertion.
1 parent b9b6900 commit ccb3c76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/obmalloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ _PyMem_Initialize(struct _pymem_runtime_state *state)
297297
state->allocators.obj = _pyobject;
298298

299299
#ifdef WITH_PYMALLOC
300+
Py_BUILD_ASSERT(NB_SMALL_SIZE_CLASSES == 64);
301+
300302
for (int i = 0; i < 8; i++) {
301-
if (NB_SMALL_SIZE_CLASSES <= i * 8)
302-
break;
303303
for (int j = 0; j < 8; j++) {
304304
int x = i * 8 + j;
305305
poolp *addr = &(state->usedpools[2*(x)]);

0 commit comments

Comments
 (0)