-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
[2.7] bpo-31692: Add PYTHONSHOWALLOCCOUNT env var #3927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Doc/using/cmdline.rst
Outdated
|
||
.. envvar:: PYTHONSHOWALLOCCOUNT | ||
|
||
If set and Python was compiled with ``COUNT_ALLOCS`` defined, Python will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth to document the changes in Doc/c-api/typeobj.rst
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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