diff options
author | Sylvain <syt@logilab.fr> | 2007-02-09 09:26:55 +0100 |
---|---|---|
committer | Sylvain <syt@logilab.fr> | 2007-02-09 09:26:55 +0100 |
commit | 720c3b8b264ac9777ebb0caa64fc7a3297a4a5af (patch) | |
tree | 0ad71bee21c5733d186be3c386349ad2ea4f8e80 /lint.py | |
parent | 4f582ef30277c409ec02a63c1a7ae5b4560c6804 (diff) | |
download | pylint-720c3b8b264ac9777ebb0caa64fc7a3297a4a5af.tar.gz |
apply ddrake patch
Diffstat (limited to 'lint.py')
-rw-r--r-- | lint.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -738,14 +738,22 @@ def preprocess_options(args, search_for): values of <search_for> are callback functions to call when the option is found """ + # Deleting from args on-the-fly while enumerating screws things up + # (indices get shifted, etc). To avoid problems, we create a list of + # indices to delete, and then do the deletions in reverse order after + # the argument processing has been completed. + to_del = [] for i, arg in enumerate(args): for option in search_for: if arg.startswith('--%s=' % option): search_for[option](option, arg[len(option)+3:]) - del args[i] + to_del.append(i) elif arg == '--%s' % option: search_for[option](option, args[i + 1]) - del args[i:i+2] + to_del.extend([i, i+1]) + to_del.reverse() + for i in to_del: + del args[i] class Run: """helper class to use as main for pylint : |