If you’ve got a base64 string as a unicode object and you try to use Python’s base64 module with altchars set, it fails with the following error:
TypeError: character mapping must return integer, None or unicode
This is a pretty unhelpful error message. It also occurs if you try any method that indirectly uses altchars. For example:
base64.urlsafe_b64decode(unicode('aass'))
base64.b64decode(unicode('aass'),'-_')
Both fail, while the following works:
base64.urlsafe_b64decode('aass')
base64.b64decode(unicode('aass'))
While it’s not complicated to fix (just convert any unicode string to an ascii string), it’s still annoying.