]> granicus.if.org Git - python/commitdiff
Fix #11583. Changed os.path.isdir to use GetFileAttributes instead of os.stat.
authorBrian Curtin <brian@python.org>
Wed, 8 Jun 2011 23:43:57 +0000 (18:43 -0500)
committerBrian Curtin <brian@python.org>
Wed, 8 Jun 2011 23:43:57 +0000 (18:43 -0500)
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.

1  2 
Misc/NEWS
Modules/posixmodule.c

diff --cc Misc/NEWS
index 1995b14158dbf4432c2f6af0d42f376c7de20e74,15ed46f8e0bdf19c97c4a6b85b6059a9fe87ba99..6f10ba6d3a164236cb573c6fb4a275962ed7631c
+++ b/Misc/NEWS
@@@ -187,27 -22,9 +187,30 @@@ Core and Builtin
  Library
  -------
  
+ - Issue #11583: Speed up os.path.isdir on Windows by using GetFileAttributes
+   instead of os.stat.
 +- Issue #12021: Make mmap's read() method argument optional. Patch by Petri
 +  Lehtinen.
 +
 +- Issue #9205: concurrent.futures.ProcessPoolExecutor now detects killed
 +  children and raises BrokenProcessPool in such a situation.  Previously it
 +  would reliably freeze/deadlock.
 +
 +- Issue #12040: Expose a new attribute ``sentinel`` on instances of
 +  :class:`multiprocessing.Process`.  Also, fix Process.join() to not use
 +  polling anymore, when given a timeout.
 +
 +- Issue #11893: Remove obsolete internal wrapper class ``SSLFakeFile`` in the
 +  smtplib module.  Patch by Catalin Iacob.
 +
 +- Issue #12080: Fix a Decimal.power() case that took an unreasonably long time
 +  to compute.
 +
 +- Issue #12221: Remove __version__ attributes from pyexpat, pickle, tarfile,
 +  pydoc, tkinter, and xml.parsers.expat. This were useless version constants
 +  left over from the Mercurial transition
 +
  - Named tuples now work correctly with vars().
  
  - Issue #12085: Fix an attribute error in subprocess.Popen destructor if the
Simple merge