diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-01-27 03:07:53 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-01-27 03:07:53 (GMT) |
commit | 1763f8adb4d2d7b59fefedff0aa8ed652c4fe8d2 (patch) | |
tree | 7033046500608b8d320607bc52b0748d11680de3 | |
parent | d081abc8be6192980c1fb06c837cc9e4fc373f55 (diff) | |
download | cpython-1763f8adb4d2d7b59fefedff0aa8ed652c4fe8d2.zip cpython-1763f8adb4d2d7b59fefedff0aa8ed652c4fe8d2.tar.gz cpython-1763f8adb4d2d7b59fefedff0aa8ed652c4fe8d2.tar.bz2 |
excellent place to use a set() #5069
-rw-r--r-- | Lib/posixpath.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 9fa53d0..6eb45fd 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -369,12 +369,12 @@ def _resolve_link(path): until we either arrive at something that isn't a symlink, or encounter a path we've seen before (meaning that there's a loop). """ - paths_seen = [] + paths_seen = set() while islink(path): if path in paths_seen: # Already seen this path, so we must have a symlink loop return None - paths_seen.append(path) + paths_seen.add(path) # Resolve where the link points to resolved = os.readlink(path) if not isabs(resolved): |