Changeset 6359063 in rtems-tools


Ignore:
Timestamp:
Mar 9, 2016, 3:39:43 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11
Children:
3e9b179
Parents:
4001a74
Message:

Python 2 and python 3 refactor fixes.

Updates #2619.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/execute.py

    r4001a74 r6359063  
    186186                    if len(data) == 0:
    187187                        break
    188                     if type(data) == bytes:
     188                    # str and bytes are the same type in Python2
     189                    if type(data) is not str and type(data) is bytes:
    189190                        data = data.decode(sys.stdout.encoding)
    190191                    for c in data:
  • rtemstoolkit/macros.py

    r4001a74 r6359063  
    189189
    190190    def __setitem__(self, key, value):
     191        key = self._unicode_to_str(key)
    191192        if type(key) is not str:
    192193            raise TypeError('bad key type (want str): %s' % (type(key)))
  • tester/rt/test.py

    r4001a74 r6359063  
    121121    def reraise(self):
    122122        if self.result is not None:
    123             raise self.result[0](self.result[1]).with_traceback(self.result[2])
     123            with_tb = getattr(self.result[1], 'with_traceback', None)
     124            if with_tb:
     125                raise self.result[1].with_traceback(self.result[2])
     126            raise (self.result[0], self.result[1], self.result[2])
    124127
    125128    def kill(self):
Note: See TracChangeset for help on using the changeset viewer.