From 787bdd37a0817d038aff9ea45d06ceb14dccece4 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 17 Aug 1997 16:25:45 +0000 Subject: [PATCH] PyTuple_SetItem should require that the tuple's refcnt is one! --- Objects/tupleobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 0faedb480ae..d6fb6b4d645 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -133,7 +133,7 @@ PyTuple_SetItem(op, i, newitem) { register PyObject *olditem; register PyObject **p; - if (!PyTuple_Check(op)) { + if (!PyTuple_Check(op) || op->ob_refcnt != 1) { Py_XDECREF(newitem); PyErr_BadInternalCall(); return -1;