[2.7] bpo-31692: Add PYTHONSHOWALLOCCOUNT env var#3927
Conversation
bpo-31692, bpo-19527: * Add a new PYTHONSHOWALLOCCOUNT environment variable, similar to the Python 3 "-X showalloccount" option * When Python is compiled with COUNT_ALLOCS, the new PYTHONSHOWALLOCCOUNT environment variable now has to be set to dump allocation counts into stderr on shutdown. Moreover, allocations statistics are now dumped into stderr rather than stdout. * Add @test.support.requires_type_collecting decorator: skip test if COUNT_ALLOCS is defined * Fix tests for COUNT_ALLOCS: decorate some methods with @requires_type_collecting * test_sys.test_objecttypes(): update object type when COUNT_ALLOCS is defined
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Using the requires_type_collecting decorator LGTM. But I don't sure about adding PYTHONSHOWALLOCCOUNT. This looks like a new feature to me.
What if split this PR on two parts? The one fixes issues related to immortal types, the other is about additional output.
|
|
||
| .. envvar:: PYTHONSHOWALLOCCOUNT | ||
|
|
||
| If set and Python was compiled with ``COUNT_ALLOCS`` defined, Python will |
There was a problem hiding this comment.
It may be worth to document the changes in Doc/c-api/typeobj.rst too.
There was a problem hiding this comment.
I prefer to keep the description of all environment variables at the same place. I added a reference to the env var in Doc/c-api/typeobj.rst.
|
Serhiy: "... This looks like a new feature to me ..." I prefer to discuss on the bpo: https://bugs.python.org/issue31692#msg303959 |
bpo-31692, bpo-19527:
the Python 3 "-X showalloccount" option
PYTHONSHOWALLOCCOUNT environment variable now has to be set to dump
allocation counts into stderr on shutdown. Moreover, allocations
statistics are now dumped into stderr rather than stdout.
COUNT_ALLOCS is defined
@requires_type_collecting
is defined
https://bugs.python.org/issue31692