From: Victor Stinner Date: Fri, 30 Apr 2010 16:48:45 +0000 (+0000) Subject: PyFile_FromFd() uses PyUnicode_DecodeFSDefault() instead of X-Git-Tag: v3.2a1~961 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0964ee1cf5ddbb1cbf367a1a1a69508983a14b04;p=python PyFile_FromFd() uses PyUnicode_DecodeFSDefault() instead of PyUnicode_FromString() to support surrogates in the filename and use the right encoding --- diff --git a/Misc/NEWS b/Misc/NEWS index b7e93182af..37fadd338d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,10 @@ What's New in Python 3.2 Alpha 1? Core and Builtins ----------------- +- PyFile_FromFd() uses PyUnicode_DecodeFSDefault() instead of + PyUnicode_FromString() to support surrogates in the filename and use the + right encoding + - PyUnicode_DecodeFSDefaultAndSize() uses surrogateescape error handler - Issue #8419: Prevent the dict constructor from accepting non-string keyword diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 85e87d701f..bbed57bc1b 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -41,7 +41,7 @@ PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding, if (stream == NULL) return NULL; if (name != NULL) { - nameobj = PyUnicode_FromString(name); + nameobj = PyUnicode_DecodeFSDefault(name); if (nameobj == NULL) PyErr_Clear(); else {