diff --git a/Misc/NEWS b/Misc/NEWS index 34329933463..81d3e81c543 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -93,6 +93,10 @@ C-API 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 951323bc91a..6d92544982c 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1769,7 +1769,7 @@ posix_ttyname(PyObject *self, PyObject *args) #endif if (ret == NULL) return posix_error(); - return PyUnicode_FromString(ret); + return PyUnicode_DecodeFSDefault(ret); } #endif @@ -1791,7 +1791,7 @@ posix_ctermid(PyObject *self, PyObject *noargs) #endif if (ret == NULL) return posix_error(); - return PyUnicode_FromString(buffer); + return PyUnicode_DecodeFSDefault(buffer); } #endif