python: Make exception handling Python 3 safe
Change-Id: I9c2cdfad20deb1ddfa224320cf93f2105d126652 Reviewed-on: https://gem5-review.googlesource.com/c/15980 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
@@ -47,8 +47,8 @@ def setGlobalFrequency(ticksPerSecond):
|
||||
elif isinstance(ticksPerSecond, str):
|
||||
tps = round(convert.anyToFrequency(ticksPerSecond))
|
||||
else:
|
||||
raise TypeError, \
|
||||
"wrong type '%s' for ticksPerSecond" % type(ticksPerSecond)
|
||||
raise TypeError(
|
||||
"wrong type '%s' for ticksPerSecond" % type(ticksPerSecond))
|
||||
_m5.core.setClockFrequency(int(tps))
|
||||
|
||||
# how big does a rounding error need to be before we warn about it?
|
||||
@@ -58,13 +58,13 @@ def fromSeconds(value):
|
||||
import _m5.core
|
||||
|
||||
if not isinstance(value, float):
|
||||
raise TypeError, "can't convert '%s' to type tick" % type(value)
|
||||
raise TypeError("can't convert '%s' to type tick" % type(value))
|
||||
|
||||
# once someone needs to convert to seconds, the global frequency
|
||||
# had better be fixed
|
||||
if not _m5.core.clockFrequencyFixed():
|
||||
raise AttributeError, \
|
||||
"In order to do conversions, the global frequency must be fixed"
|
||||
raise AttributeError(
|
||||
"In order to do conversions, the global frequency must be fixed")
|
||||
|
||||
if value == 0:
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user