Browse files

Bug fix: do not mutate list while iterating over it.

  • Loading branch information...
1 parent 8306d44 commit ec38cb7600dc2f6971c71d4042392006a4931b5d @dairiki dairiki committed May 14, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 pip/req.py
View
5 pip/req.py
@@ -276,7 +276,10 @@ def egg_info_path(self, filename):
for dir in vcs.dirnames:
if dir in dirs:
dirs.remove(dir)
- for dir in dirs:
+ # Iterate over a copy of ``dirs``, since mutating
+ # a list while iterating over it can cause trouble.
+ # (See https://github.com/pypa/pip/pull/462.)
+ for dir in list(dirs):
# Don't search in anything that looks like a virtualenv environment
if (os.path.exists(os.path.join(root, dir, 'bin', 'python'))
or os.path.exists(os.path.join(root, dir, 'Scripts', 'Python.exe'))):

0 comments on commit ec38cb7

Please sign in to comment.