[issue21784] __init__.py can be a directory

STINNER Victor report at bugs.python.org
Tue Jun 17 18:00:59 CEST 2014


STINNER Victor added the comment:

I remember that I added an check in Python 3.2 on the file type to explicitly reject directories:
http://hg.python.org/cpython/rev/125887a41a6f

+            if (stat(buf, &statbuf) == 0 && S_ISDIR(statbuf.st_mode))
+                /* it's a directory */
+                fp = NULL;
+            else

I wrote this change in the C code, I didn't report the change to the Python code (importlib).

A huge work was also done in importlib to reduce the number of calls to stat(). So maybe a check was dropped by mistake?

----------

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


More information about the Python-bugs-list mailing list