summaryrefslogtreecommitdiff
path: root/Modules/cPickle.c
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-10-14 19:33:31 +0000
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-10-14 19:33:31 +0000
commit973f8b4ca6b2614968d76760c38f5adc31da2727 (patch)
treee5158484d256980e0d3599ce6f6694b38f80d0d1 /Modules/cPickle.c
parente6039f09781bee1e37c8a9fb6436b6df5b8d16b8 (diff)
downloadcpython-git-973f8b4ca6b2614968d76760c38f5adc31da2727.tar.gz
Make cPickle.Unpickler.noload() handle dict subclasses. noload() is
an obscure, undocumentated feature so no test was added. Closes issue #1101399.
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r--Modules/cPickle.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index a84942403b..bbc14bf4d4 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -5049,6 +5049,33 @@ noload_extension(Unpicklerobject *self, int nbytes)
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 @@ noload(Unpicklerobject *self)
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 @@ noload(Unpicklerobject *self)
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;