mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() when running on valgrind.
This commit is contained in:
parent
cb04acf425
commit
0aaaa62200
2 changed files with 8 additions and 3 deletions
|
|
@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks()
|
||||||
|
when running on valgrind.
|
||||||
|
|
||||||
- Issue #17619: Make input() check for Ctrl-C correctly on Windows.
|
- Issue #17619: Make input() check for Ctrl-C correctly on Windows.
|
||||||
|
|
||||||
- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during
|
- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during
|
||||||
|
|
|
||||||
|
|
@ -778,6 +778,8 @@ PyObject_Malloc(size_t nbytes)
|
||||||
poolp next;
|
poolp next;
|
||||||
uint size;
|
uint size;
|
||||||
|
|
||||||
|
_Py_AllocatedBlocks++;
|
||||||
|
|
||||||
#ifdef WITH_VALGRIND
|
#ifdef WITH_VALGRIND
|
||||||
if (UNLIKELY(running_on_valgrind == -1))
|
if (UNLIKELY(running_on_valgrind == -1))
|
||||||
running_on_valgrind = RUNNING_ON_VALGRIND;
|
running_on_valgrind = RUNNING_ON_VALGRIND;
|
||||||
|
|
@ -791,10 +793,10 @@ PyObject_Malloc(size_t nbytes)
|
||||||
* things without checking for overflows or negatives.
|
* things without checking for overflows or negatives.
|
||||||
* As size_t is unsigned, checking for nbytes < 0 is not required.
|
* As size_t is unsigned, checking for nbytes < 0 is not required.
|
||||||
*/
|
*/
|
||||||
if (nbytes > PY_SSIZE_T_MAX)
|
if (nbytes > PY_SSIZE_T_MAX) {
|
||||||
|
_Py_AllocatedBlocks--;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
_Py_AllocatedBlocks++;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This implicitly redirects malloc(0).
|
* This implicitly redirects malloc(0).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue