]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 15 Aug 2010 09:12:51 +0000 (09:12 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 15 Aug 2010 09:12:51 +0000 (09:12 +0000)
using the filesystem encoding and surrogateescape error handler. Patch
written by David Watson.

Misc/NEWS
Modules/posixmodule.c

index 7164fcc2298d40a999fe1d96c2403a2cef5dc9df..f5cfd384421651af26655a49c005b9f3d3b5656c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -83,6 +83,10 @@ Extensions
 Library
 -------
 
+- Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
+  using the filesystem encoding and surrogateescape error handler. Patch
+  written by David Watson.
+
 - Issue #8688: MANIFEST files created by distutils now include a magic
   comment indicating they are generated.  Manually maintained MANIFESTs
   without this marker will not be overwritten or removed.
index 087457ec4ba60227a13e7cf88e012f3d458c373f..df7cb832579ec9147abf4d32a5167aa514dfaa57 100644 (file)
@@ -1849,7 +1849,7 @@ posix_ttyname(PyObject *self, PyObject *args)
 #endif
     if (ret == NULL)
         return posix_error();
-    return PyUnicode_FromString(ret);
+    return PyUnicode_DecodeFSDefault(ret);
 }
 #endif
 
@@ -1871,7 +1871,7 @@ posix_ctermid(PyObject *self, PyObject *noargs)
 #endif
     if (ret == NULL)
         return posix_error();
-    return PyUnicode_FromString(buffer);
+    return PyUnicode_DecodeFSDefault(buffer);
 }
 #endif