py: Raise TypeError when trying to format non-int with %x,%o,%X.

This behaviour follows Python 3.5 standard (in 3.4 it's a
DeprecationWarning which we'd rather make a TypeError).