Fix OrderedSet `__repr__` protocol for non-string objects

Prefer using `repr` on the keys to `str` since `repr` is guaranteed to
be implemented, and will return something "good enough"
pull/1758/head
Dylan Baker 8 years ago
parent 63c4c54a64
commit 93187797d6
  1. 3
      mesonbuild/mesonlib.py

@ -708,7 +708,8 @@ class OrderedSet(collections.MutableSet):
def __repr__(self):
# Don't print 'OrderedSet("")' for an empty set.
if self.__container:
return 'OrderedSet("{}")'.format('", "'.join(self.__container.keys()))
return 'OrderedSet("{}")'.format(
'", "'.join(repr(e) for e in self.__container.keys()))
return 'OrderedSet()'
def add(self, value):

Loading…
Cancel
Save