]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Closes #12291 for 3.3 - merged fix from 3.2.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 2 Jul 2011 16:16:02 +0000 (17:16 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 2 Jul 2011 16:16:02 +0000 (17:16 +0100)
1  2 
Lib/test/test_marshal.py
Misc/NEWS
Python/marshal.c

Simple merge
diff --cc Misc/NEWS
index 06932608adb5328cb31824afda6c361b6d3588c2,2013559be884bb7ecc85bb1ba48c1528ad2e53d0..547c0faa8094c45cc2a170e11be26b35ae53687c
+++ b/Misc/NEWS
@@@ -10,13 -10,9 +10,16 @@@ What's New in Python 3.3 Alpha 1
  Core and Builtins
  -----------------
  
+ - Issue #12291: You can now load multiple marshalled objects from a stream,
+   with other data interleaved between marshalled objects.
 +- Issue #12356: When required positional or keyword-only arguments are not
 +  given, produce a informative error message which includes the name(s) of the
 +  missing arguments.
 +
 +- Issue #12370: Fix super with not arguments when __class__ is overriden in the
 +  class body.
 +
  - Issue #12084: os.stat on Windows now works properly with relative symbolic
    links when called from any directory.
  
index 7b327ade01d97dd2f042c1f332464056e145ea95,396e05c63817aa182b2319f4c63c8e1281e97a38..b8d06ad286481041d6617f3c23d11981b00ec34e
@@@ -57,10 -57,11 +57,11 @@@ typedef struct 
      int error;  /* see WFERR_* values */
      int depth;
      /* If fp == NULL, the following are valid: */
+     PyObject * readable;    /* Stream-like object being read from */
      PyObject *str;
 +    PyObject *current_filename;
      char *ptr;
      char *end;
 -    PyObject *strings; /* dict on marshal, list on unmarshal */
      int version;
  } WFILE;
  
@@@ -1049,8 -1129,9 +1138,9 @@@ PyMarshal_ReadShortFromFile(FILE *fp
  {
      RFILE rf;
      assert(fp);
+     rf.readable = NULL;
      rf.fp = fp;
 -    rf.strings = NULL;
 +    rf.current_filename = NULL;
      rf.end = rf.ptr = NULL;
      return r_short(&rf);
  }
@@@ -1060,7 -1141,8 +1150,8 @@@ PyMarshal_ReadLongFromFile(FILE *fp
  {
      RFILE rf;
      rf.fp = fp;
 -    rf.strings = NULL;
+     rf.readable = NULL;
 +    rf.current_filename = NULL;
      rf.ptr = rf.end = NULL;
      return r_long(&rf);
  }
@@@ -1121,7 -1203,8 +1212,8 @@@ PyMarshal_ReadObjectFromFile(FILE *fp
      RFILE rf;
      PyObject *result;
      rf.fp = fp;
 -    rf.strings = PyList_New(0);
+     rf.readable = NULL;
 +    rf.current_filename = NULL;
      rf.depth = 0;
      rf.ptr = rf.end = NULL;
      result = r_object(&rf);
@@@ -1134,11 -1218,13 +1226,12 @@@ PyMarshal_ReadObjectFromString(char *st
      RFILE rf;
      PyObject *result;
      rf.fp = NULL;
+     rf.readable = NULL;
 +    rf.current_filename = NULL;
      rf.ptr = str;
      rf.end = str + len;
 -    rf.strings = PyList_New(0);
      rf.depth = 0;
      result = r_object(&rf);
 -    Py_DECREF(rf.strings);
      return result;
  }
  
@@@ -1300,11 -1390,13 +1395,12 @@@ marshal_loads(PyObject *self, PyObject 
      s = p.buf;
      n = p.len;
      rf.fp = NULL;
+     rf.readable = NULL;
 +    rf.current_filename = NULL;
      rf.ptr = s;
      rf.end = s + n;
 -    rf.strings = PyList_New(0);
      rf.depth = 0;
      result = read_object(&rf);
 -    Py_DECREF(rf.strings);
      PyBuffer_Release(&p);
      return result;
  }