[Python-checkins] python/dist/src/Objects stringobject.c, 2.223, 2.224

arigo at users.sourceforge.net arigo at users.sourceforge.net
Sat Aug 7 22:58:34 CEST 2004


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21715/Objects

Modified Files:
	stringobject.c 
Log Message:
This was quite a dark bug in my recent in-place string concatenation
hack: it would resize *interned* strings in-place!  This occurred because
their reference counts do not have their expected value -- stringobject.c
hacks them.  Mea culpa.


Index: stringobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v
retrieving revision 2.223
retrieving revision 2.224
diff -C2 -d -r2.223 -r2.224
*** stringobject.c	7 Aug 2004 19:27:39 -0000	2.223
--- stringobject.c	7 Aug 2004 20:58:32 -0000	2.224
***************
*** 3514,3518 ****
  	register PyStringObject *sv;
  	v = *pv;
! 	if (!PyString_Check(v) || v->ob_refcnt != 1 || newsize < 0) {
  		*pv = 0;
  		Py_DECREF(v);
--- 3514,3519 ----
  	register PyStringObject *sv;
  	v = *pv;
! 	if (!PyString_Check(v) || v->ob_refcnt != 1 || newsize < 0 ||
! 	    PyString_CHECK_INTERNED(v)) {
  		*pv = 0;
  		Py_DECREF(v);



More information about the Python-checkins mailing list