[gyb] Work-around PEP 3106 for Python 3 compatibility

PEP 3106 [1] changed the behavior of the dictionaries `items` method.
In Python 2, `items` builds a real list of tuples where `iteritems`
returns a generator. PEP 3106 changes Python 3's `items` method to be
equivalent to Python 2's `iteritems` and completely removes `iteritems`
in Python 3.

This patch switches to both to use `items`. This could have a negative
impact on Python 2's performance because it now causes the dictionary
tuples to be built in memory.

[1] https://www.python.org/dev/peps/pep-3106/
This commit is contained in:
Ryan Lovelett
2015-12-28 16:01:15 -05:00
parent 7dbb4127f5
commit c8e74d1ba1

View File

@@ -66,7 +66,7 @@ class GraphemeClusterBreakPropertyTable(UnicodeProperty):
# values to symbolic values.
self.symbolic_values = \
[ None ] * (max(self.numeric_value_table.values()) + 1)
for k,v in self.numeric_value_table.iteritems():
for k,v in self.numeric_value_table.items():
self.symbolic_values[v] = k
# Load the data file.