From d458974c454ee977dc0bd3b9f1116df7d4037ab2 Mon Sep 17 00:00:00 2001 From: Serge Guelton Date: Tue, 18 Dec 2018 16:04:21 +0000 Subject: Portable Python script across Python version In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead. The portability patch consists in forcing an extra `list` call if the result is actually used as a list. `map` are replaced by list comprehension and `filter` by filtered list comprehension. Differential Revision: https://reviews.llvm.org/D55197 llvm-svn: 349501 --- clang/bindings/python/examples/cindex/cindex-dump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/bindings/python/examples/cindex') diff --git a/clang/bindings/python/examples/cindex/cindex-dump.py b/clang/bindings/python/examples/cindex/cindex-dump.py index 5556ad121a3..acec7e0e005 100644 --- a/clang/bindings/python/examples/cindex/cindex-dump.py +++ b/clang/bindings/python/examples/cindex/cindex-dump.py @@ -79,7 +79,7 @@ def main(): if not tu: parser.error("unable to load input") - pprint(('diags', map(get_diag_info, tu.diagnostics))) + pprint(('diags', [get_diag_info(d) for d in tu.diagnostics])) pprint(('nodes', get_info(tu.cursor))) if __name__ == '__main__': -- cgit v1.2.3