This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove redundant code in ntpath.walk()
Type: enhancement Stage:
Components: Windows Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, mhagger, rhettinger
Priority: normal Keywords: patch

Created on 2007-04-08 12:03 by mhagger, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ntpath-walk.diff mhagger, 2007-04-08 12:03 Patch to remove redundant code in ntpath.walk()
Messages (2)
msg52399 - (view) Author: Michael Haggerty (mhagger) Date: 2007-04-08 12:03
The documentation for os.listdir() explicitly says that it omits directories '.' and '..' even if they are present in the directory, and the implementation in posixmodule.c seems to agree.

Yet the implementation of os.path.walk() in ntpath.py still checks for and excludes '.' and '..' from the names gotten from os.listdir().  This seems like dead code.

The analogous check was removed from posixpath.py by Guido in r14534, with the comment

> Remove some redundant logic from walk() -- there's no need to check
> for "." and "..", since listdir() no longer returns those.

The attached patch removes the extra check.  It is relative to trunk r54712.

I don't have a Windows computer around to test this patch, but it seems straightforward enough.
msg59373 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-06 14:17
Fixed in r59769. Thanks!
History
Date User Action Args
2022-04-11 14:56:23adminsetgithub: 44817
2008-01-06 14:17:53georg.brandlsetstatus: open -> closed
assignee: rhettinger -> georg.brandl
resolution: fixed
messages: + msg59373
nosy: + georg.brandl
2008-01-06 11:58:29christian.heimessettype: enhancement
versions: + Python 2.6
2007-04-08 12:03:06mhaggercreate