Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
using the filesystem encoding and surrogateescape error handler. Patch
written by David Watson.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 087457e..df7cb83 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1849,7 +1849,7 @@
 #endif
     if (ret == NULL)
         return posix_error();
-    return PyUnicode_FromString(ret);
+    return PyUnicode_DecodeFSDefault(ret);
 }
 #endif
 
@@ -1871,7 +1871,7 @@
 #endif
     if (ret == NULL)
         return posix_error();
-    return PyUnicode_FromString(buffer);
+    return PyUnicode_DecodeFSDefault(buffer);
 }
 #endif