ARM-software / trappy

This repository has moved to https://gitlab.arm.com/tooling/trappy
Apache License 2.0
60 stars 39 forks source link

base: Fix string to int conversion #288

Closed valschneider closed 5 years ago

valschneider commented 5 years ago

Because it relied on str.isdigit(), Base.string_cast() would erroneously assume a hex string (e.g. "0x42") wouldn't be castable to int.

Use a more robust pattern using try/except blocks. This will happily cope with negative and hex values.

While at it, rename string_cast() to string_cast_int(), since the former only handles ints and does an ugly empty return when the specified type isn't int.

valschneider commented 5 years ago

We seem to have been hitting this "KeyError: 'A53_freq_out'" travis error for a while. It seems to be with Python3 only, any ideas why?