a9f6e89
--- Python-2.7.5/Python/marshal.c	2013-05-12 05:32:53.000000000 +0200
a9f6e89
+++ /home/rkuska/hg/cpython/Python/marshal.c	2013-07-18 10:33:26.392486235 +0200
a9f6e89
@@ -88,7 +88,7 @@
a9f6e89
 }
a9f6e89
 
a9f6e89
 static void
a9f6e89
-w_string(char *s, Py_ssize_t n, WFILE *p)
a9f6e89
+w_string(const char *s, Py_ssize_t n, WFILE *p)
a9f6e89
 {
a9f6e89
     if (p->fp != NULL) {
a9f6e89
         fwrite(s, 1, n, p->fp);
a9f6e89
@@ -141,6 +141,13 @@
a9f6e89
 # define W_SIZE  w_long
a9f6e89
 #endif
a9f6e89
 
a9f6e89
+static void
a9f6e89
+w_pstring(const char *s, Py_ssize_t n, WFILE *p)
a9f6e89
+{
a9f6e89
+        W_SIZE(n, p);
a9f6e89
+        w_string(s, n, p);
a9f6e89
+}
a9f6e89
+
a9f6e89
 /* We assume that Python longs are stored internally in base some power of
a9f6e89
    2**15; for the sake of portability we'll always read and write them in base
a9f6e89
    exactly 2**15. */
a9f6e89
@@ -338,9 +345,7 @@
a9f6e89
         else {
a9f6e89
             w_byte(TYPE_STRING, p);
a9f6e89
         }
a9f6e89
-        n = PyString_GET_SIZE(v);
a9f6e89
-        W_SIZE(n, p);
a9f6e89
-        w_string(PyString_AS_STRING(v), n, p);
a9f6e89
+        w_pstring(PyBytes_AS_STRING(v), PyString_GET_SIZE(v), p);
a9f6e89
     }
a9f6e89
 #ifdef Py_USING_UNICODE
a9f6e89
     else if (PyUnicode_CheckExact(v)) {
a9f6e89
@@ -352,9 +357,7 @@
a9f6e89
             return;
a9f6e89
         }
a9f6e89
         w_byte(TYPE_UNICODE, p);
a9f6e89
-        n = PyString_GET_SIZE(utf8);
a9f6e89
-        W_SIZE(n, p);
a9f6e89
-        w_string(PyString_AS_STRING(utf8), n, p);
a9f6e89
+        w_pstring(PyString_AS_STRING(utf8), PyString_GET_SIZE(utf8), p);
a9f6e89
         Py_DECREF(utf8);
a9f6e89
     }
a9f6e89
 #endif
a9f6e89
@@ -441,8 +444,7 @@
a9f6e89
         PyBufferProcs *pb = v->ob_type->tp_as_buffer;
a9f6e89
         w_byte(TYPE_STRING, p);
a9f6e89
         n = (*pb->bf_getreadbuffer)(v, 0, (void **)&s);
a9f6e89
-        W_SIZE(n, p);
a9f6e89
-        w_string(s, n, p);
a9f6e89
+        w_pstring(s, n, p);
a9f6e89
     }
a9f6e89
     else {
a9f6e89
         w_byte(TYPE_UNKNOWN, p);