This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients bup, docs@python, eric.smith, steven.daprano, tim.peters
Date 2018-06-10.00:46:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528591568.82.0.592728768989.issue33814@psf.upfronthosting.co.za>
In-reply-to
Content
Dan, your bug report is pretty much incoherent ;-)  This standard Stack Overflow advice applies here too:

https://stackoverflow.com/help/mcve

Guessing your complaint is that:

    sys.getrefcount(itertools.repeat)

keeps increasing by 1 across calls to `leaks()`, then as Eric said it will drop back to its original value after a `gc.collect()` call.

Steven, best I can tell weakrefs have nothing to do with this.  The refcount on itertools.repeat increases if

    weakref.ref(ns['f']), 

is deleted.

It's a simple reference cycle.  That is

    ns['f'].__globals__ is ns

is True, so `ns` can't be collected via reference counting, and so `ns` also holds a reference to the irrelevantly renamed `itertools.repeat` too until cyclic gc can detect the trash cycle.

Dan, if that's _not_ what you're complaining about, please follow the advice at the top and add a focused, minimal example of what you are talking about.  In the meantime, I'm closing this as not-a-bug.
History
Date User Action Args
2018-06-10 00:46:08tim.peterssetrecipients: + tim.peters, eric.smith, steven.daprano, docs@python, bup
2018-06-10 00:46:08tim.peterssetmessageid: <1528591568.82.0.592728768989.issue33814@psf.upfronthosting.co.za>
2018-06-10 00:46:08tim.peterslinkissue33814 messages
2018-06-10 00:46:07tim.peterscreate