[Patches] [ python-Patches-1696393 ] Remove redundant code in ntpath.walk()

SourceForge.net noreply at sourceforge.net
Wed Apr 11 19:38:27 CEST 2007


Patches item #1696393, was opened at 2007-04-08 07:03
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1696393&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Michael Haggerty (mhagger)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: Remove redundant code in ntpath.walk()

Initial Comment:
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1696393&group_id=5470


More information about the Patches mailing list