Skip to content

Commit 553c235

Browse files
author
benjamin.peterson
committed
excellent place to use a set() #5069
git-svn-id: http://svn.python.org/projects/python/trunk@69003 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent c76288f commit 553c235

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/posixpath.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,12 @@ def _resolve_link(path):
369369
until we either arrive at something that isn't a symlink, or
370370
encounter a path we've seen before (meaning that there's a loop).
371371
"""
372-
paths_seen = []
372+
paths_seen = set()
373373
while islink(path):
374374
if path in paths_seen:
375375
# Already seen this path, so we must have a symlink loop
376376
return None
377-
paths_seen.append(path)
377+
paths_seen.add(path)
378378
# Resolve where the link points to
379379
resolved = os.readlink(path)
380380
if not isabs(resolved):

0 commit comments

Comments
 (0)