Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5fe6de8

Browse files
author
Victor Stinner
committed
Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
using the filesystem encoding and surrogateescape error handler. Patch written by David Watson.
1 parent 0b5669c commit 5fe6de8

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ Extensions
8383
Library
8484
-------
8585

86+
- Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
87+
using the filesystem encoding and surrogateescape error handler. Patch
88+
written by David Watson.
89+
8690
- Issue #8688: MANIFEST files created by distutils now include a magic
8791
comment indicating they are generated. Manually maintained MANIFESTs
8892
without this marker will not be overwritten or removed.

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ posix_ttyname(PyObject *self, PyObject *args)
18491849
#endif
18501850
if (ret == NULL)
18511851
return posix_error();
1852-
return PyUnicode_FromString(ret);
1852+
return PyUnicode_DecodeFSDefault(ret);
18531853
}
18541854
#endif
18551855

@@ -1871,7 +1871,7 @@ posix_ctermid(PyObject *self, PyObject *noargs)
18711871
#endif
18721872
if (ret == NULL)
18731873
return posix_error();
1874-
return PyUnicode_FromString(buffer);
1874+
return PyUnicode_DecodeFSDefault(buffer);
18751875
}
18761876
#endif
18771877

0 commit comments

Comments
 (0)