[Python-checkins] cpython (3.5): Fix resize_compact()
victor.stinner
python-checkins at python.org
Wed Jan 27 11:01:32 EST 2016
https://hg.python.org/cpython/rev/8de6f19afc86
changeset: 100074:8de6f19afc86
branch: 3.5
parent: 100072:ce3d47eaeb21
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Jan 27 16:56:53 2016 +0100
summary:
Fix resize_compact()
Issue #26217: resize_compact() must set wstr_length to 0 after freeing the wstr
string. Otherwise, an assertion fails in _PyUnicode_CheckConsistency().
files:
Objects/unicodeobject.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -748,6 +748,8 @@
else if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) {
PyObject_DEL(_PyUnicode_WSTR(unicode));
_PyUnicode_WSTR(unicode) = NULL;
+ if (!PyUnicode_IS_ASCII(unicode))
+ _PyUnicode_WSTR_LENGTH(unicode) = 0;
}
#ifdef Py_DEBUG
unicode_fill_invalid(unicode, old_length);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list