summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:04:21 +0000
committerSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:04:21 +0000
commitbd8d3419e1b6a1c7ec82e1ceb1f22b407a38dac9 (patch)
tree560bc893dd4d59a78b0bc277418faeb97299917c /bindings
parent38ed7e5d7917d18c9c7af9c49c5d83a112c6222a (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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/examples/cindex/cindex-dump.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bindings/python/examples/cindex/cindex-dump.py b/bindings/python/examples/cindex/cindex-dump.py
index 5556ad121a..acec7e0e00 100644
--- a/bindings/python/examples/cindex/cindex-dump.py
+++ b/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__':