summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2004-08-07 20:58:32 (GMT)
committerArmin Rigo <arigo@tunes.org>2004-08-07 20:58:32 (GMT)
commit618fbf5469ec6b8013b00989623763db21dd0ce5 (patch)
tree038a1948057047243f99e38569ec472120f86eda /Objects/stringobject.c
parent25847813c18b500d661137364b9041c6b08a75ea (diff)
downloadcpython-618fbf5469ec6b8013b00989623763db21dd0ce5.zip
cpython-618fbf5469ec6b8013b00989623763db21dd0ce5.tar.gz
cpython-618fbf5469ec6b8013b00989623763db21dd0ce5.tar.bz2
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.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index e29ed48..b40351a 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -3513,7 +3513,8 @@ _PyString_Resize(PyObject **pv, int newsize)
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();