[PATCH] D30773: Make git-clang-format python 3 compatible

Eric Fiselier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 00:37:46 PST 2017


EricWF marked 2 inline comments as done.
EricWF added inline comments.


================
Comment at: tools/clang-format/git-clang-format:323
   allowed_extensions = frozenset(allowed_extensions)
-  for filename in dictionary.keys():
+  for filename in list(dictionary.keys()):
     base_ext = filename.rsplit('.', 1)
----------------
EricWF wrote:
> kimgr wrote:
> > This should not be necessary for iteration -- in Python3 it returns a generator instead of a list, but generators can be iterated.
> This was done by the 2to3 tool. I'll have to see what it thinks it was up to. But I agree this seems wrong.
Ah, so this is needed because in python 3 it's a runtime error to remove items from a dictionary while iterating over the keys. So we have to make a copy first.


https://reviews.llvm.org/D30773





More information about the llvm-commits mailing list