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 vstinner
Recipients ncoghlan, njs, vstinner, yselivanov
Date 2016-11-07.08:56:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwY2WL1aGXkT8OyE7U2nLt2jOQWqJnoGcLUSy_bA-bDQHg@mail.gmail.com>
In-reply-to <1478487031.39.0.63356302946.issue28629@psf.upfronthosting.co.za>
Content
To take a decision, I would suggest to implement the warning, run the
Python test suite, and run the test suite of a few applications like
Twisted and Django, to see how much code needs to be modified.

Well, let's say that my code consumes a generator but emits the
warning because it doesn't consume completely the warning. What am I
supposed to do?

Let's say the the generator is an infine suite like (2**i for i in
itertools.count()). Should I call gen.close()?

If a generator holds a resource like a file, does gen.close()
immediately release the resource? Or does it rely on the garbage
collector?

I'm curious to see if using source=frame when emitting the warning
helps to identify quickly the origin of the bug. I added the source
parameter in Python 3.6. It requires the usage of tracemalloc to log
where the source object (the frame in this case) was allocated.
History
Date User Action Args
2016-11-07 08:56:04vstinnersetrecipients: + vstinner, ncoghlan, njs, yselivanov
2016-11-07 08:56:04vstinnerlinkissue28629 messages
2016-11-07 08:56:04vstinnercreate