diff options
author | Mathieu Bridon <[email protected]> | 2018-07-06 12:20:26 +0200 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-07-24 11:07:04 -0700 |
commit | 5530cb1296cef759ea2f94e581da0a4d853a9f5f (patch) | |
tree | 58a8bd7809d98f0fc8425615282b56b64c059086 /src/mapi/glapi/gen/gl_gentable.py | |
parent | fdf946ffbfa23afde1b42fd8a342f5c42e413cc0 (diff) |
python: Better iterate over dictionaries
In Python 2, dictionaries have 2 sets of methods to iterate over their
keys and values: keys()/values()/items() and iterkeys()/itervalues()/iteritems().
The former return lists while the latter return iterators.
Python 3 dropped the method which return lists, and renamed the methods
returning iterators to keys()/values()/items().
Using those names makes the scripts compatible with both Python 2 and 3.
Signed-off-by: Mathieu Bridon <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/mapi/glapi/gen/gl_gentable.py')
-rw-r--r-- | src/mapi/glapi/gen/gl_gentable.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py index 73fa6c6daac..49206b11671 100644 --- a/src/mapi/glapi/gen/gl_gentable.py +++ b/src/mapi/glapi/gen/gl_gentable.py @@ -202,13 +202,13 @@ class PrintCode(gl_XML.gl_print_base): # Determine how many functions have a defined offset. func_count = 0 - for f in api.functions_by_name.itervalues(): + for f in api.functions_by_name.values(): if f.offset != -1: func_count += 1 # Build the mapping from offset to function name. funcnames = [None] * func_count - for f in api.functions_by_name.itervalues(): + for f in api.functions_by_name.values(): if f.offset != -1: if not (funcnames[f.offset] is None): raise Exception("Function table has more than one function with same offset (offset %d, func %s)" % (f.offset, f.name)) |