[Python-checkins] r75424 - python/trunk/Modules/cPickle.c
neil.schemenauer
python-checkins at python.org
Wed Oct 14 21:33:31 CEST 2009
Author: neil.schemenauer
Date: Wed Oct 14 21:33:31 2009
New Revision: 75424
Log:
Make cPickle.Unpickler.noload() handle dict subclasses. noload() is
an obscure, undocumentated feature so no test was added. Closes
issue #1101399.
Modified:
python/trunk/Modules/cPickle.c
Modified: python/trunk/Modules/cPickle.c
==============================================================================
--- python/trunk/Modules/cPickle.c (original)
+++ python/trunk/Modules/cPickle.c Wed Oct 14 21:33:31 2009
@@ -5049,6 +5049,33 @@
return 0;
}
+static int
+noload_append(Unpicklerobject *self)
+{
+ return Pdata_clear(self->stack, self->stack->length - 1);
+}
+
+static int
+noload_appends(Unpicklerobject *self)
+{
+ int i;
+ if ((i = marker(self)) < 0) return -1;
+ return Pdata_clear(self->stack, i);
+}
+
+static int
+noload_setitem(Unpicklerobject *self)
+{
+ return Pdata_clear(self->stack, self->stack->length - 2);
+}
+
+static int
+noload_setitems(Unpicklerobject *self)
+{
+ int i;
+ if ((i = marker(self)) < 0) return -1;
+ return Pdata_clear(self->stack, i);
+}
static PyObject *
noload(Unpicklerobject *self)
@@ -5207,12 +5234,12 @@
continue;
case APPEND:
- if (load_append(self) < 0)
+ if (noload_append(self) < 0)
break;
continue;
case APPENDS:
- if (load_appends(self) < 0)
+ if (noload_appends(self) < 0)
break;
continue;
@@ -5287,12 +5314,12 @@
continue;
case SETITEM:
- if (load_setitem(self) < 0)
+ if (noload_setitem(self) < 0)
break;
continue;
case SETITEMS:
- if (load_setitems(self) < 0)
+ if (noload_setitems(self) < 0)
break;
continue;
More information about the Python-checkins
mailing list