summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Objects/stringobject.c3
-rw-r--r--Python/ceval.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index e29ed4806f..b40351afcb 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();
diff --git a/Python/ceval.c b/Python/ceval.c
index 4dd31ab9ba..4c9bdeda13 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4253,7 +4253,7 @@ string_concatenate(PyObject *v, PyObject *w,
}
}
- 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.
*/