Issue #9871: Prevent IDLE 3 crash when given byte stings
with invalid hex escape sequences, like b'\x0'.
(Original patch by Claudiu Popa.)