cpplint: use list() for working with python3

In python3, dict.keys() returns a view instead of a separate
dictionary, which results in the following error while trying
to use cpplint:

"RuntimeError: dictionary changed size during iteration"

Use a list of the keyset instead.

R=ehmaldonado@chromium.org

Bug: 1027160
Change-Id: I0040b8912d7e446d35d755bb021670c9f2248f4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1966743
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Sarthak Kukreti <sarthakkukreti@chromium.org>
changes/43/1966743/2
Sarthak Kukreti 6 years ago committed by Commit Bot
parent a33af2239e
commit 6037820448

2
cpplint.py vendored

@ -5433,7 +5433,7 @@ def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
# include_dict is modified during iteration, so we iterate over a copy of
# the keys.
header_keys = include_dict.keys()
header_keys = list(include_dict.keys())
for header in header_keys:
(same_module, common_path) = FilesBelongToSameModule(abs_filename, header)
fullpath = common_path + header

Loading…
Cancel
Save