diff options
author | Brett Cannon <brett@python.org> | 2013-10-18 17:24:13 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-10-18 17:24:13 (GMT) |
commit | 58f56804629e177e3d05c45542cd793c3177de40 (patch) | |
tree | 671eec5dedbb31533471ab9e86e4aba070707fce /Include/enumobject.h | |
parent | 2546a177650264205e8a52b6836bc5b8c48bf085 (diff) | |
download | cpython-58f56804629e177e3d05c45542cd793c3177de40.zip cpython-58f56804629e177e3d05c45542cd793c3177de40.tar.gz cpython-58f56804629e177e3d05c45542cd793c3177de40.tar.bz2 |
Issue #18810: Be optimistic with stat calls when seeing if a directory
exists when checking for a package.
Before there was an isdir check and then various isfile checks for
possible __init__ files when looking for a package.
This change drops the isdir check by leaning
on the assumption that a directory will not contain something named
after the module being imported which is not a directory. If the module
is a package then it saves a stat call. If there is nothing in the
directory with the potential package name it also saves a stat call.
Only if there is something in the directory named the same thing as
the potential package will the number of stat calls increase
(due to more wasteful __init__ checks).
Semantically there is no change as the isdir check moved
down so that namespace packages continue to have no chance of
accidentally collecting non-existent directories.
Diffstat (limited to 'Include/enumobject.h')
0 files changed, 0 insertions, 0 deletions