summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2003-08-14 17:04:28 (GMT)
committerMichael W. Hudson <mwh@python.net>2003-08-14 17:04:28 (GMT)
commitb4f49385a30d51c2c1a5ecc67c703b595c236efc (patch)
tree1dc930845bdac7ef52f891bb9c98adfb8cff3d38
parent7d599482f29ae45c27735b21fab3c7e8db20e87a (diff)
downloadcpython-b4f49385a30d51c2c1a5ecc67c703b595c236efc.zip
cpython-b4f49385a30d51c2c1a5ecc67c703b595c236efc.tar.gz
cpython-b4f49385a30d51c2c1a5ecc67c703b595c236efc.tar.bz2
Fix reference leak noted in test_types:
Check for a[:] = a _before_ calling PySequence_Fast on a. release23-maint candidate Reference leak doesn't happen with head of release22-maint.
-rw-r--r--Objects/listobject.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index b059420..ed28200 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -472,15 +472,6 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v)
n = 0;
else {
char msg[256];
- PyOS_snprintf(msg, sizeof(msg),
- "must assign sequence"
- " (not \"%.200s\") to slice",
- v->ob_type->tp_name);
- v_as_SF = PySequence_Fast(v, msg);
- if(v_as_SF == NULL)
- return -1;
- n = PySequence_Fast_GET_SIZE(v_as_SF);
-
if (a == b) {
/* Special case "a[i:j] = a" -- copy b first */
int ret;
@@ -491,6 +482,15 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v)
Py_DECREF(v);
return ret;
}
+
+ PyOS_snprintf(msg, sizeof(msg),
+ "must assign sequence"
+ " (not \"%.200s\") to slice",
+ v->ob_type->tp_name);
+ v_as_SF = PySequence_Fast(v, msg);
+ if(v_as_SF == NULL)
+ return -1;
+ n = PySequence_Fast_GET_SIZE(v_as_SF);
}
if (ilow < 0)
ilow = 0;