[Python-checkins] CVS: python/dist/src/Python exceptions.c,1.21,1.22
Fred L. Drake
fdrake@users.sourceforge.net
Wed, 28 Feb 2001 13:52:12 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv29704
Modified Files:
exceptions.c
Log Message:
SyntaxError__init__(): Be a little more robust when picking apart the
location information for the SyntaxError -- do not do more than we
need to, stopping as soon as an exception has been raised.
Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** exceptions.c 2001/02/28 16:44:18 1.21
--- exceptions.c 2001/02/28 21:52:10 1.22
***************
*** 703,707 ****
if (lenargs == 2) {
PyObject *info = PySequence_GetItem(args, 1);
! PyObject *filename, *lineno, *offset, *text;
int status = 1;
--- 703,708 ----
if (lenargs == 2) {
PyObject *info = PySequence_GetItem(args, 1);
! PyObject *filename = NULL, *lineno = NULL;
! PyObject *offset = NULL, *text = NULL;
int status = 1;
***************
*** 710,729 ****
filename = PySequence_GetItem(info, 0);
! lineno = PySequence_GetItem(info, 1);
! offset = PySequence_GetItem(info, 2);
! text = PySequence_GetItem(info, 3);
!
! Py_DECREF(info);
!
! if (filename && lineno && offset && text) {
! status = PyObject_SetAttrString(self, "filename", filename) ||
! PyObject_SetAttrString(self, "lineno", lineno) ||
! PyObject_SetAttrString(self, "offset", offset) ||
! PyObject_SetAttrString(self, "text", text);
}
! Py_XDECREF(filename);
! Py_XDECREF(lineno);
! Py_XDECREF(offset);
! Py_XDECREF(text);
if (status)
--- 711,735 ----
filename = PySequence_GetItem(info, 0);
! if (filename != NULL) {
! lineno = PySequence_GetItem(info, 1);
! if (lineno != NULL) {
! offset = PySequence_GetItem(info, 2);
! if (offset != NULL) {
! text = PySequence_GetItem(info, 3);
! if (text != NULL) {
! status =
! PyObject_SetAttrString(self, "filename", filename)
! || PyObject_SetAttrString(self, "lineno", lineno)
! || PyObject_SetAttrString(self, "offset", offset)
! || PyObject_SetAttrString(self, "text", text);
! Py_DECREF(text);
! }
! Py_DECREF(offset);
! }
! Py_DECREF(lineno);
! }
! Py_DECREF(filename);
}
! Py_DECREF(info);
if (status)