summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-06-28 06:28:31 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-06-28 06:28:31 (GMT)
commit0f8b31a2dad17ed18ff11fbe36e8d56dce4de0b5 (patch)
tree3636fc302c33540cd946821036c8f96a871a38f4
parent7983c7298d2c1254bc17a5a1ab696bdf0360b63d (diff)
downloadcpython-0f8b31a2dad17ed18ff11fbe36e8d56dce4de0b5.zip
cpython-0f8b31a2dad17ed18ff11fbe36e8d56dce4de0b5.tar.gz
cpython-0f8b31a2dad17ed18ff11fbe36e8d56dce4de0b5.tar.bz2
Fix bug #1512695: cPickle.loads could crash if it was interrupted with
a KeyboardInterrupt since PyTuple_Pack was passed a NULL. Will backport.
-rw-r--r--Misc/NEWS6
-rw-r--r--Modules/cPickle.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index cefa739..efbb145 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -28,6 +28,12 @@ Library
- The wsgiref package is now installed properly on Unix.
+Extension Modules
+-----------------
+
+- Bug #1512695: cPickle.loads could crash if it was interrupted with
+ a KeyboardInterrupt.
+
Build
-----
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 0d29362..6b9b322 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -3628,10 +3628,14 @@ Instance_New(PyObject *cls, PyObject *args)
err:
{
- PyObject *tp, *v, *tb;
+ PyObject *tp, *v, *tb, *tmp_value;
PyErr_Fetch(&tp, &v, &tb);
- if ((r=PyTuple_Pack(3,v,cls,args))) {
+ tmp_value = v;
+ /* NULL occurs when there was a KeyboardInterrupt */
+ if (tmp_value == NULL)
+ tmp_value = Py_None;
+ if ((r = PyTuple_Pack(3, tmp_value, cls, args))) {
Py_XDECREF(v);
v=r;
}