[New-bugs-announce] [issue31681] pkgutil.get_data() leaks open files in Python 2.7

Elvis Pranskevichus report at bugs.python.org
Tue Oct 3 15:39:44 EDT 2017


New submission from Elvis Pranskevichus <elvis at magic.io>:

pkgutil.get_data() does this:

     def get_data(self, pathname):
        return open(pathname, "rb").read()

which very obviously leaks open file descriptors.  This has been fixed in 3.x by https://github.com/python/cpython/commit/1ab58dfb12dedb7, but never backported to 2.7.

----------
components: Library (Lib)
messages: 303642
nosy: Elvis.Pranskevichus
priority: normal
severity: normal
status: open
title: pkgutil.get_data() leaks open files in Python 2.7
type: resource usage
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31681>
_______________________________________


More information about the New-bugs-announce mailing list