Also remove the safe_ord() since its usage introduces ambiguity.
What was wrong?
safe_ord( ) is attempting to tolerate int as input but ord() as a build-in should take 1-byte length byte.
ord(c)
Given a string representing one Unicode character, return an integer
As its name suggests, safe_ord( ) or its caller should enforce the input type instead. But since ord( )would raise TypeError if being given a character. The rest thing to do is to enforce the input type to bytes_to_int( ).
How was it fixed?
Said function is removed. Add input type check to bytes_to_int( ).
Cute Animal Picture
![put a cute animal picture link inside the parentheses]()
Also remove the safe_ord() since its usage introduces ambiguity.
What was wrong?
safe_ord( ) is attempting to tolerate
int
as input but ord() as a build-in should take 1-byte length byte.As its name suggests, safe_ord( ) or its caller should enforce the input type instead. But since ord( )would raise
TypeError
if being given a character. The rest thing to do is to enforce the input type to bytes_to_int( ).How was it fixed?
Said function is removed. Add input type check to bytes_to_int( ).
Cute Animal Picture
![put a cute animal picture link inside the parentheses]()