New submission from Serhiy Storchaka:

os.scandir() opens a file descriptor and closes it only in its destructor. This 
can causes file descriptor leaks in Python implementations without reference 
counting and if the scandir iterator becomes a part of reference loop or long 
living object. Since the number of open file descriptors is limited, this can 
leads to problems.

We need to add the close() method to the scandir iterator (as in files and 
generators). It would be useful also to make it a context manager.

In 3.5 we have to add a warning about this behavior.

----------
components: Extension Modules
messages: 257351
nosy: benhoyt, haypo, serhiy.storchaka
priority: high
severity: normal
status: open
title: File descriptor leaks in os.scandir()
type: resource usage
versions: Python 3.5, Python 3.6

_______________________________________
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