[Python-checkins] r80663 - in python/branches/py3k: Misc/NEWS Objects/fileobject.c

victor.stinner python-checkins at python.org
Fri Apr 30 18:48:45 CEST 2010


Author: victor.stinner
Date: Fri Apr 30 18:48:45 2010
New Revision: 80663

Log:
PyFile_FromFd() uses PyUnicode_DecodeFSDefault() instead of
PyUnicode_FromString() to support surrogates in the filename and use the right
encoding


Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Objects/fileobject.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Fri Apr 30 18:48:45 2010
@@ -12,6 +12,10 @@
 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

Modified: python/branches/py3k/Objects/fileobject.c
==============================================================================
--- python/branches/py3k/Objects/fileobject.c	(original)
+++ python/branches/py3k/Objects/fileobject.c	Fri Apr 30 18:48:45 2010
@@ -41,7 +41,7 @@
 	if (stream == NULL)
 		return NULL;
 	if (name != NULL) {
-		nameobj = PyUnicode_FromString(name);
+		nameobj = PyUnicode_DecodeFSDefault(name);
 		if (nameobj == NULL)
 			PyErr_Clear();
 		else {


More information about the Python-checkins mailing list