diff Python/fileutils.c @ 80704:af6fd3ca6de9 3.2

Issue #16416: Fix compilation error
author Victor Stinner <victor.stinner@gmail.com>
date Mon, 03 Dec 2012 14:11:57 +0100
parents c838c9b117f1
children c256764e2b3f 2a67d79490ae
line wrap: on
line diff
--- a/Python/fileutils.c	Mon Dec 03 12:47:59 2012 +0100
+++ b/Python/fileutils.c	Mon Dec 03 14:11:57 2012 +0100
@@ -169,7 +169,9 @@
     if (unicode == NULL)
         return NULL;
 
-    bytes = _PyUnicode_AsUTF8String(unicode, "surrogateescape");
+    bytes = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
+                                 PyUnicode_GET_SIZE(unicode),
+                                 "surrogateescape");
     Py_DECREF(unicode);
     if (bytes == NULL) {
         PyErr_Clear();