[Python-checkins] cpython: PyUnicode_New() sets utf8_length to zero for latin1
victor.stinner
python-checkins at python.org
Tue Oct 4 01:16:14 CEST 2011
http://hg.python.org/cpython/rev/e59f4265033b
changeset: 72627:e59f4265033b
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Tue Oct 04 01:02:02 2011 +0200
summary:
PyUnicode_New() sets utf8_length to zero for latin1
files:
Objects/unicodeobject.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -755,7 +755,7 @@
PyCompactUnicodeObject *unicode;
void *data;
int kind_state;
- int is_sharing = 0, is_ascii = 0;
+ int is_sharing, is_ascii;
Py_ssize_t char_size;
Py_ssize_t struct_size;
@@ -769,6 +769,8 @@
++unicode_new_new_calls;
#endif
+ is_ascii = 0;
+ is_sharing = 0;
struct_size = sizeof(PyCompactUnicodeObject);
if (maxchar < 128) {
kind_state = PyUnicode_1BYTE_KIND;
@@ -833,11 +835,12 @@
((char*)data)[size] = 0;
_PyUnicode_WSTR(unicode) = NULL;
_PyUnicode_WSTR_LENGTH(unicode) = 0;
+ unicode->utf8 = NULL;
unicode->utf8_length = 0;
- unicode->utf8 = NULL;
}
else {
unicode->utf8 = NULL;
+ unicode->utf8_length = 0;
if (kind_state == PyUnicode_2BYTE_KIND)
((Py_UCS2*)data)[size] = 0;
else /* kind_state == PyUnicode_4BYTE_KIND */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list