[Python-checkins] cpython: Issue #21233: Fix _PyObject_Alloc() when compiled with WITH_VALGRIND defined

victor.stinner python-checkins at python.org
Tue May 6 11:32:48 CEST 2014


http://hg.python.org/cpython/rev/358a12f4d4bc
changeset:   90565:358a12f4d4bc
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue May 06 11:32:29 2014 +0200
summary:
  Issue #21233: Fix _PyObject_Alloc() when compiled with WITH_VALGRIND defined

files:
  Objects/obmalloc.c |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -1176,6 +1176,9 @@
 
     _Py_AllocatedBlocks++;
 
+    assert(nelem <= PY_SSIZE_T_MAX / elsize);
+    nbytes = nelem * elsize;
+
 #ifdef WITH_VALGRIND
     if (UNLIKELY(running_on_valgrind == -1))
         running_on_valgrind = RUNNING_ON_VALGRIND;
@@ -1183,9 +1186,6 @@
         goto redirect;
 #endif
 
-    assert(nelem <= PY_SSIZE_T_MAX / elsize);
-    nbytes = nelem * elsize;
-
     if (nelem == 0 || elsize == 0)
         goto redirect;
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list