]> granicus.if.org Git - python/commit
Fix #11583. Changed os.path.isdir to use GetFileAttributes instead of os.stat.
authorBrian Curtin <brian@python.org>
Wed, 8 Jun 2011 23:17:18 +0000 (18:17 -0500)
committerBrian Curtin <brian@python.org>
Wed, 8 Jun 2011 23:17:18 +0000 (18:17 -0500)
commit9c669ccc77c85eac245d460bab510a38b20d9a08
tree067c0f49c9e1fd369765a12003b3f8bc502c7175
parent41c1910bb3229874a02c19ecd9189715b3ce501b
Fix #11583. Changed os.path.isdir to use GetFileAttributes instead of os.stat.

By changing to the Windows GetFileAttributes API in nt._isdir we can figure
out if the path is a directory without opening the file via os.stat. This has
the minor benefit of speeding up os.path.isdir by at least 2x for regular
files and 10-15x improvements were seen on symbolic links (which opened the
file multiple times during os.stat). Since os.path.isdir is used in
several places on interpreter startup, we get a minor speedup in startup time.
Lib/ntpath.py
Misc/NEWS
Modules/posixmodule.c