Issue #6697: Check that _PyUnicode_AsString() result is not NULL in textio.c

The bug may occurs if locale.getpreferredencoding() returns an encoding with a
surrogate (very unlikely!).
1 file changed