Skip to content

Commit

Permalink
python: Manually convert float to int when using %x
Browse files Browse the repository at this point in the history
This is required by python3.5 which is not allowing a
floating point value to be printed in hex and will trigger
a TypeError assertion:

TypeError: %X format: an integer is required, not float

Change-Id: I2033366751924579cc87e7fccda8fdb33a31412d
Signed-off-by: Giacomo Travaglini <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28607
Reviewed-by: Bobby R. Bruce <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
  • Loading branch information
giactra committed May 6, 2020
1 parent 58a797d commit 38e7427
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/m5/util/dot_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def dot_gen_colour(simNode, isPort = False):
return dot_rgb_to_html(r, g, b)

def dot_rgb_to_html(r, g, b):
return "#%.2x%.2x%.2x" % (r, g, b)
return "#%.2x%.2x%.2x" % (int(r), int(g), int(b))

# We need to create all of the clock domains. We abuse the alpha channel to get
# the correct domain colouring.
Expand Down

0 comments on commit 38e7427

Please sign in to comment.