diff Objects/stringobject.c @ 33030:8607ac2f81c8 legacy-trunk

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.
author Armin Rigo <arigo@tunes.org>
date Sat, 07 Aug 2004 20:58:32 +0000
parents 4f588f57a93b
children 03440272028c
line wrap: on
line diff
--- a/Objects/stringobject.c	Sat Aug 07 20:30:03 2004 +0000
+++ b/Objects/stringobject.c	Sat Aug 07 20:58:32 2004 +0000
@@ -3513,7 +3513,8 @@
 	register PyObject *v;
 	register PyStringObject *sv;
 	v = *pv;
-	if (!PyString_Check(v) || v->ob_refcnt != 1 || newsize < 0) {
+	if (!PyString_Check(v) || v->ob_refcnt != 1 || newsize < 0 ||
+	    PyString_CHECK_INTERNED(v)) {
 		*pv = 0;
 		Py_DECREF(v);
 		PyErr_BadInternalCall();