perf: make code work with Python 3

Authored by indygreg.


perf: make code work with Python 3

We need b'' because isn't run through the source

We need to cast the exception to bytes using pycompat.bytestr()
because ValueError can't be %s formatted due to built-in exceptions
lacking bytes.

We need to pycompat.sysstr() before the float() and int() cast
so the ValueError message doesn't have b'' in it.

Even with that, it looks like the error message for the ValueError
for float casts added quotes, so we need to account for that in test

Differential Revision: