diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 16:04:21 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 16:04:21 +0000 |
commit | d458974c454ee977dc0bd3b9f1116df7d4037ab2 (patch) | |
tree | 31145842c1fd7a6a775c7f9c506af4bbc67eb9dd /clang/bindings | |
parent | e9effe9744bda67051ab2ff0a76ecc9e99488efa (diff) |
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
Diffstat (limited to 'clang/bindings')
-rw-r--r-- | clang/bindings/python/examples/cindex/cindex-dump.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/bindings/python/examples/cindex/cindex-dump.py b/clang/bindings/python/examples/cindex/cindex-dump.py index 5556ad121a3e..acec7e0e0054 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__': |