summaryrefslogtreecommitdiffstats
path: root/Objects/obmalloc.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-14 21:48:37 (GMT)
committerGitHub <noreply@github.com>2017-09-14 21:48:37 (GMT)
commitccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43 (patch)
tree571f86dcc7d2d769429ca7ec9c1df730a6035a00 /Objects/obmalloc.c
parentb9b69003d91c6ea94b890ce24ed25686d30f1428 (diff)
downloadcpython-ccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43.zip
cpython-ccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43.tar.gz
cpython-ccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43.tar.bz2
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.
Diffstat (limited to 'Objects/obmalloc.c')
-rw-r--r--Objects/obmalloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 57edf97..f2651d7 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)]);