diff Python/ceval.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 fb6ffd290cfb
children f455bbe7ea7e
line wrap: on
line diff
--- a/Python/ceval.c	Sat Aug 07 20:30:03 2004 +0000
+++ b/Python/ceval.c	Sat Aug 07 20:58:32 2004 +0000
@@ -4253,7 +4253,7 @@
 		}
 	}
 
-	if (v->ob_refcnt == 1) {
+	if (v->ob_refcnt == 1 && !PyString_CHECK_INTERNED(v)) {
 		/* Now we own the last reference to 'v', so we can resize it
 		 * in-place.
 		 */