[issue7732] imp.find_module crashes Python if there exists a directory named "__init__.py"

Florent Xicluna report at bugs.python.org
Thu Jan 28 21:11:28 CET 2010


Florent Xicluna <laxyf at yahoo.fr> added the comment:

> if PyFile_FromFile fails for another reason (PyString_FromString(name)
> runs out of memory), the fp is not closed and the caller is right to
> call fclose().

As far as I understand, the fp is never left open, when PyFile_FromFile returns NULL. So there's no reason to call fclose on it.

However I found a reference leak in the case you describe (PyString_FromString(name) == NULL).

It is fixed with this last update.

----------
Added file: http://bugs.python.org/file16029/issue7732_find_module_v2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7732>
_______________________________________


More information about the Python-bugs-list mailing list