]> granicus.if.org Git - python/commitdiff
PyFile_FromFd() uses PyUnicode_DecodeFSDefault() instead of
authorVictor Stinner <victor.stinner@haypocalc.com>
Fri, 30 Apr 2010 16:48:45 +0000 (16:48 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Fri, 30 Apr 2010 16:48:45 +0000 (16:48 +0000)
PyUnicode_FromString() to support surrogates in the filename and use the right
encoding

Misc/NEWS
Objects/fileobject.c

index b7e93182af283f9c3e679a6cd76a679504b6dc95..37fadd338dbaeea5b3a06fc77af9144e44062fce 100644 (file)
--- 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
index 85e87d701ffb4b2c90a2fad143fd43b35f6da076..bbed57bc1b155dc52f9665a935ce0f49bd0707ca 100644 (file)
@@ -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 {