Skip to content

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Oct 9, 2017

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

https://bugs.python.org/issue31692

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 serhiy-storchaka changed the title [2.7] Add PYTHONSHOWALLOCCOUNT env var [2.7] bpo-31692: Add PYTHONSHOWALLOCCOUNT env var Oct 9, 2017
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.


.. envvar:: PYTHONSHOWALLOCCOUNT

If set and Python was compiled with ``COUNT_ALLOCS`` defined, Python will
Copy link
Member

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.

Copy link
Member Author

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.

@vstinner
Copy link
Member Author

vstinner commented Oct 9, 2017

Serhiy: "... This looks like a new feature to me ..."

I prefer to discuss on the bpo: https://bugs.python.org/issue31692#msg303959

@serhiy-storchaka serhiy-storchaka added type-feature A feature request or enhancement tests Tests in the Lib/test dir labels Oct 9, 2017
@vstinner vstinner merged commit 7b4ba62 into python:2.7 Oct 17, 2017
@vstinner vstinner deleted the count_allocs_envvar27 branch October 17, 2017 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants