Here is a patch catching the _PyUnicode_AsString() error.
input() uses sys.stdout.encoding to encode the prompt to a byte string, but
PyOS_StdioReadline() writes the prompt to stderr (it should use sys_stdout).
I don't know which encoding should be used if sys.stdout.encoding is None (eg.
if sys.stdout is a StringIO() object).
StringIO() of _io module has no encoding because it stores unicode characters,
not bytes. StringIO() of _pyio module is based on BytesIO() and use utf8
encoding, but the reference implementation is now _io.