From 6037820448a9dbe4f53902edf438a9ad5a6cac5d Mon Sep 17 00:00:00 2001 From: Sarthak Kukreti Date: Tue, 17 Dec 2019 20:46:58 +0000 Subject: [PATCH] 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 Reviewed-by: Edward Lesmes Commit-Queue: Sarthak Kukreti --- cpplint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpplint.py b/cpplint.py index dad86fe0dd..3aa06b0e6c 100755 --- a/cpplint.py +++ b/cpplint.py @@ -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