Josh Rosenberg added the comment:

Adding a ResourceWarning even if the generator is run to completion? That 
seems... dev hostile. I mean, yes, probably best to document it as best 
practice to use with with statement, but something simple like `files = 
sorted(os.scandir('.'), key=lambda x: x.stat().st_mtime)` to get files ordered 
by modification time (which cleanly runs the generator to exhaustion 
immediately) should not be raising ResourceWarning in 3.6 when it didn't do so 
in 3.5, and has minimal risk of leaking in any event.

----------
nosy: +josh.r

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25994>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to