[PATCH] D30773: Make git-clang-format python 3 compatible
Kim Gräsman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 01:08:40 PST 2017
kimgr 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:
> 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.
Oh, I see, I didn't catch that. Carry on.
https://reviews.llvm.org/D30773
More information about the llvm-commits
mailing list