From 5fe6de8c72977c794cbc39001ffd21ae7297684a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 15 Aug 2010 09:12:51 +0000 Subject: [PATCH] Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name using the filesystem encoding and surrogateescape error handler. Patch written by David Watson. --- Misc/NEWS | 4 ++++ Modules/posixmodule.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 7164fcc229..f5cfd38442 100644 --- 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. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 087457ec4b..df7cb83257 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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 -- 2.50.1