[Python-checkins] CVS: python/dist/src/Python compile.c,2.104,2.105
Fred Drake
python-dev@python.org
Thu, 13 Apr 2000 10:10:47 -0400
Update of /projects/cvsroot/python/dist/src/Python
In directory seahag.cnri.reston.va.us:/home/fdrake/projects/python/Python
Modified Files:
compile.c
Log Message:
M.-A. Lemburg <mal@lemburg.com>:
Fixed problem with Unicode string concatenation:
u = (u"abc" u"abc") previously dumped core.
Index: compile.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/compile.c,v
retrieving revision 2.104
retrieving revision 2.105
diff -C2 -r2.104 -r2.105
*** compile.c 2000/04/10 16:20:31 2.104
--- compile.c 2000/04/13 14:10:44 2.105
***************
*** 985,993 ****
if ((v = parsestr(STR(CHILD(n, 0)))) != NULL) {
/* String literal concatenation */
! for (i = 1; i < NCH(n) && v != NULL; i++) {
! PyString_ConcatAndDel(&v, parsestr(STR(CHILD(n, i))));
}
}
return v;
}
--- 985,1014 ----
if ((v = parsestr(STR(CHILD(n, 0)))) != NULL) {
/* String literal concatenation */
! for (i = 1; i < NCH(n); i++) {
! PyObject *s;
! s = parsestr(STR(CHILD(n, i)));
! if (s == NULL)
! goto onError;
! if (PyString_Check(v) && PyString_Check(s)) {
! PyString_ConcatAndDel(&v, s);
! if (v == NULL)
! goto onError;
! }
! else {
! PyObject *temp;
! temp = PyUnicode_Concat(v, s);
! Py_DECREF(s);
! if (temp == NULL)
! goto onError;
! Py_DECREF(v);
! v = temp;
! }
}
}
return v;
+
+ onError:
+ Py_XDECREF(v);
+ return NULL;
}