diff Modules/_struct.c @ 51596:a83f10edb6ff

#3694: fix an "XXX undetected error" leak in struct.
author Georg Brandl <georg@python.org>
date Fri, 13 Feb 2009 11:01:07 +0000
parents 87fbbf22adf3
children 5cace75bcb05
line wrap: on
line diff
--- a/Modules/_struct.c	Fri Feb 13 10:50:01 2009 +0000
+++ b/Modules/_struct.c	Fri Feb 13 11:01:07 2009 +0000
@@ -1785,7 +1785,7 @@
 	assert( buffer_len >= 0 );
 
 	/* Extract the offset from the first argument */
-	offset = PyLong_AsSsize_t(PyTuple_GET_ITEM(args, 1));
+	offset = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 1), PyExc_IndexError);
 	if (offset == -1 && PyErr_Occurred())
 		return NULL;