[... a huge number of reference leaks reported ...]

FYI, I "reduced" the relatively simple test_bisect's leaks to this
self-contained program:

libreftest = """
    No actual doctests here.
"""

import doctest
import gc

def main():
    from sys import gettotalrefcount as trc
    for i in range(10):
        doctest.testmod()
        print trc()
        doctest.master = None
        gc.collect()

if __name__ == "__main__":
    main()

Running that here in a debug build:

C:\Code\python\PCbuild>python_d blah.py
54867
54873
54879
54885
54891
54897
54903
54909
54915
54921

So it leaks 6 references per iteration, and merely invoking
doctest.testmod() is all it takes to provoke it.  Comment out the:

         test_support.run_doctest(test_bisect, verbose)

line in test_bisect.py, and test_bisect stops leaking too (which isn't
a trivial stmt:  its doctests are a small part of test_bisect --
_most_ of it isn't leaking).

What happens next isn't obvious to me -- nobody has touched doctest.py
in over 2 weeks, so that's not the _source_ of the problem.  Alas, I
won't have computer access for the next 13 hours or so, and have to
leave this here for now.

FWIW, the biggest change that went in since that last "normal" refleak
run is the new exception reworking, so that has to be a top suspect.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to