Author: ericwf Date: Thu Apr 20 16:23:58 2017 New Revision: 300895 URL: http://llvm.org/viewvc/llvm-project?rev=300895&view=rev Log: Fix Python 2 vs 3 incompatability with dict.items() vs iteritems()
Modified: cfe/trunk/tools/clang-format/git-clang-format Modified: cfe/trunk/tools/clang-format/git-clang-format URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/git-clang-format?rev=300895&r1=300894&r2=300895&view=diff ============================================================================== --- cfe/trunk/tools/clang-format/git-clang-format (original) +++ cfe/trunk/tools/clang-format/git-clang-format Thu Apr 20 16:23:58 2017 @@ -345,8 +345,13 @@ def run_clang_format_and_save_to_tree(ch """Run clang-format on each file and save the result to a git tree. Returns the object ID (SHA-1) of the created tree.""" + def iteritems(container): + try: + return container.iteritems() # Python 2 + except AttributeError: + return container.items() # Python 3 def index_info_generator(): - for filename, line_ranges in changed_lines.viewitems(): + for filename, line_ranges in iteritems(changed_lines): if revision: git_metadata_cmd = ['git', 'ls-tree', '%s:%s' % (revision, os.path.dirname(filename)), _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits