Author vstinner
Recipients eric.snow, eryksun, matrixise, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2017-06-07.09:06:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The failing unit test was added by:

commit 2d350fd8af29eada0c3f264a91df6ab4af4a05fd
Author: Antoine Pitrou <>
Date:   Thu Aug 1 20:56:12 2013 +0200

    Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, and make it GC-aware.

Using git bisect, I found that the leak was introduced by:

commit 6b4be195cd8868b76eb6fbe166acc39beee8ce36
Author: Eric Snow <>
Date:   Mon May 22 21:36:03 2017 -0700

    bpo-22257: Small changes for PEP 432. (#1728)
    PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.

To run a git bisection, start with an old commit, 1 month ago: 5d7a8d0c13737fd531b722ad76c505ef47aac96a (May, 1). Spoiler: the test doesn't leak at this bisection.

git bisect reset
git bisect start

git checkout master
make && ./python -m test -R 3:3 -m test_callbacks_leak test_atexit
# test fails
git bisect bad  # bad=test fails (ref leak)

git checkout 5d7a8d0c13737fd531b722ad76c505ef47aac96a
make && ./python -m test -R 3:3 -m test_callbacks_leak test_atexit
# test pass
git bisect good  # good=test pass (no leak)

make && ./python -m test -R 3:3 -m test_callbacks_leak test_atexit
# git bisect good or bad depending on the test result

# ... continue until git bisect finds the commit ...

At the end, you should get the commit 6b4be195cd8868b76eb6fbe166acc39beee8ce36.

@Eric Snow: Please don't fix the bug, please explain how to fix it ;-)
Date User Action Args
2017-06-07 09:06:15vstinnersetrecipients: + vstinner, paul.moore, tim.golden, eric.snow, zach.ware, eryksun, steve.dower, matrixise
2017-06-07 09:06:15vstinnersetmessageid: <>
2017-06-07 09:06:15vstinnerlinkissue30547 messages
2017-06-07 09:06:15vstinnercreate