Message280193
| 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. |
|