[rtems-source-builder commit] sb: Convert any unicode keys to strings

Chris Johns chrisj at rtems.org
Sun Feb 25 21:33:58 UTC 2018


Module:    rtems-source-builder
Branch:    4.11
Commit:    883dfa53a3a43c7114544eada6dd2a579f0458cf
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=883dfa53a3a43c7114544eada6dd2a579f0458cf

Author:    Chris Johns <chrisj at rtems.org>
Date:      Fri Feb 23 13:03:11 2018 +1100

sb: Convert any unicode keys to strings

Closes #3313

---

 source-builder/sb/macros.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/source-builder/sb/macros.py b/source-builder/sb/macros.py
index 28a52b2..cf25783 100644
--- a/source-builder/sb/macros.py
+++ b/source-builder/sb/macros.py
@@ -150,7 +150,7 @@ class macros:
     def __setitem__(self, key, value):
         key = self._unicode_to_str(key)
         if type(key) is not str:
-            raise TypeError('bad key type (want str): %s' % (type(key)))
+            raise TypeError('bad key type (want str): %s (%s)' % (type(key), key))
         if type(value) is not tuple:
             value = self._unicode_to_str(value)
         if type(value) is str:
@@ -396,6 +396,7 @@ class macros:
                                 (path.host(self.expand(name))))
 
     def get(self, key, globals = True, maps = None):
+        key = self._unicode_to_str(key)
         if type(key) is not str:
             raise TypeError('bad key type: %s' % (type(key)))
         key = self.key_filter(key)
@@ -435,11 +436,10 @@ class macros:
         return self.get_attribute(key) == 'override'
 
     def define(self, key, value = '1'):
-        if type(key) is not str:
-            raise TypeError('bad key type: %s' % (type(key)))
         self.__setitem__(key, ('none', 'none', value))
 
     def undefine(self, key):
+        key = self._unicode_to_str(key)
         if type(key) is not str:
             raise TypeError('bad key type: %s' % (type(key)))
         key = self.key_filter(key)



More information about the vc mailing list