[Python-Dev] [Python-checkins] cpython: Following issue #13390, fix compilation --without-pymalloc, and make (original) (raw)
Andrew Svetlov andrew.svetlov at gmail.com
Tue Dec 18 13:28:59 CET 2012
- Previous message: [Python-Dev] cpython: Issue #16049: add abc.ABC helper class.
- Next message: [Python-Dev] Understanding the buffer API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Looks like Windows buildbots broken by this commit.
On Tue, Dec 18, 2012 at 12:07 AM, antoine.pitrou <python-checkins at python.org> wrote:
http://hg.python.org/cpython/rev/a85673b55177 changeset: 80923:a85673b55177 user: Antoine Pitrou <solipsis at pitrou.net> date: Mon Dec 17 23:05:59 2012 +0100 summary: Following issue #13390, fix compilation --without-pymalloc, and make sys.getallocatedblocks() return 0 in that situation.
files: Doc/library/sys.rst | 15 ++++++++------- Lib/test/testsys.py | 7 ++++++- Objects/obmalloc.c | 7 +++++++ 3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -396,16 +396,17 @@ .. function:: getallocatedblocks() Return the number of memory blocks currently allocated by the interpreter, - regardless of their size. This function is mainly useful for debugging - small memory leaks. Because of the interpreter's internal caches, the - result can vary from call to call; you may have to call - :func:
cleartypecache()
to get more predictable results. + regardless of their size. This function is mainly useful for tracking + and debugging memory leaks. Because of the interpreter's internal + caches, the result can vary from call to call; you may have to call + :func:cleartypecache()
and :func:gc.collect()
to get more + predictable results. + + If a Python build or implementation cannot reasonably compute this + information, :func:getallocatedblocks()
is allowed to return 0 instead. .. versionadded:: 3.4 - .. impl-detail:: - Not all Python implementations may be able to return this information. - .. function:: getcheckinterval() diff --git a/Lib/test/testsys.py b/Lib/test/testsys.py --- a/Lib/test/testsys.py +++ b/Lib/test/testsys.py @@ -7,6 +7,7 @@ import operator import codecs import gc +import sysconfig # count the number of test runs, used to create unique # strings to intern in testintern() @@ -616,9 +617,13 @@ "sys.getallocatedblocks unavailable on this build") def testgetallocatedblocks(self): # Some sanity checks + withpymalloc = sysconfig.getconfigvar('WITHPYMALLOC') a = sys.getallocatedblocks() self.assertIs(type(a), int) - self.assertGreater(a, 0) + if withpymalloc: + self.assertGreater(a, 0) + else: + self.assertEqual(a, 0) try: # While we could imagine a Python session where the number of # multiple buffer objects would exceed the sharing of references, diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1316,6 +1316,13 @@ { PyMemFREE(p); } + +Pyssizet +PyGetAllocatedBlocks(void) +{ + return 0; +} + #endif /* WITHPYMALLOC */ #ifdef PYMALLOCDEBUG -- Repository URL: http://hg.python.org/cpython
Python-checkins mailing list Python-checkins at python.org http://mail.python.org/mailman/listinfo/python-checkins
-- Thanks, Andrew Svetlov
- Previous message: [Python-Dev] cpython: Issue #16049: add abc.ABC helper class.
- Next message: [Python-Dev] Understanding the buffer API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]