summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2014-04-28 23:33:59 -0700
committerThomas A Caswell <tcaswell@gmail.com>2015-09-29 14:43:14 -0400
commitd9a9f70ef6e3b1ef0f4baccf94780d286e51bbb0 (patch)
treecf2fbae8e6364e521da2132cbefed09ff636b404 /giscanner
parenta75e72763a52757daea4c1f917dc2922029a3af5 (diff)
downloadgobject-introspection-d9a9f70ef6e3b1ef0f4baccf94780d286e51bbb0.tar.gz
giscanner: Convert map() results to list
Convert the results map() calls to a list for Python 3 compatibility. In Python 3, map() returns an iterable "map object" which does not allow indexing or iteration more than once. https://bugzilla.gnome.org/show_bug.cgi?id=679438
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/gdumpparser.py4
-rw-r--r--giscanner/girparser.py6
-rw-r--r--giscanner/transformer.py2
3 files changed, 6 insertions, 6 deletions
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index 179bbd83..ebd33f98 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -438,8 +438,8 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
def _parse_parents(self, xmlnode, node):
parents_str = xmlnode.attrib.get('parents', '')
if parents_str != '':
- parent_types = map(lambda s: ast.Type.create_from_gtype_name(s),
- parents_str.split(','))
+ parent_types = list(map(lambda s: ast.Type.create_from_gtype_name(s),
+ parents_str.split(',')))
else:
parent_types = []
node.parent_chain = parent_types
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 76dc5afb..248e223a 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -455,8 +455,8 @@ class GIRParser(object):
return ast.Type(ctype=ctype)
elif name in ['GLib.List', 'GLib.SList']:
subchild = self._find_first_child(typenode,
- map(_corens, ('callback', 'array',
- 'varargs', 'type')))
+ list(map(_corens, ('callback', 'array',
+ ' varargs', 'type'))))
if subchild is not None:
element_type = self._parse_type(typenode)
else:
@@ -464,7 +464,7 @@ class GIRParser(object):
return ast.List(name, element_type, ctype=ctype)
elif name == 'GLib.HashTable':
subchildren = self._find_children(typenode, _corens('type'))
- subchildren_types = map(self._parse_type_simple, subchildren)
+ subchildren_types = list(map(self._parse_type_simple, subchildren))
while len(subchildren_types) < 2:
subchildren_types.append(ast.TYPE_ANY)
return ast.Map(subchildren_types[0], subchildren_types[1], ctype=ctype)
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 6cd7dc28..2d5c04d7 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -278,7 +278,7 @@ currently-scanned namespace is first."""
unprefixed_namespaces.append(ns)
if matches:
matches.sort(self._sort_matches)
- return map(lambda x: (x[0], x[1]), matches)
+ return list(map(lambda x: (x[0], x[1]), matches))
elif self._accept_unprefixed:
return [(self._namespace, name)]
elif unprefixed_namespaces: