diff Python/marshal.c @ 84511:697d722d97f9

Issue #18408: Fix marshal reader for Unicode strings: handle PyUnicode_DecodeUTF8() failure (ex: MemoryError).
author Victor Stinner <victor.stinner@gmail.com>
date Mon, 08 Jul 2013 22:23:32 +0200
parents 942a7061e8ad
children 19ed630d8d75
line wrap: on
line diff
--- a/Python/marshal.c	Mon Jul 08 22:20:44 2013 +0200
+++ b/Python/marshal.c	Mon Jul 08 22:23:32 2013 +0200
@@ -998,6 +998,10 @@
         else {
             v = PyUnicode_New(0, 0);
         }
+        if (v == NULL) {
+            retval = NULL;
+            break;
+        }
         if (type == TYPE_INTERNED)
             PyUnicode_InternInPlace(&v);
         retval = v;