On Tue, 22 Nov 2011 21:29:43 +0100 benjamin.peterson <python-check...@python.org> wrote: > http://hg.python.org/cpython/rev/77ab830930ae > changeset: 73697:77ab830930ae > user: Benjamin Peterson <benja...@python.org> > date: Tue Nov 22 15:29:32 2011 -0500 > summary: > fix compiler warning by implementing this more cleverly
You mean "more obscurely"? Obfuscating the original intent in order to disable a compiler warning doesn't seem very wise to me. Regards Antoine. > files: > Objects/unicodeobject.c | 7 +------ > 1 files changed, 1 insertions(+), 6 deletions(-) > > > diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c > --- a/Objects/unicodeobject.c > +++ b/Objects/unicodeobject.c > @@ -6164,12 +6164,7 @@ > kind = PyUnicode_KIND(unicode); > data = PyUnicode_DATA(unicode); > len = PyUnicode_GET_LENGTH(unicode); > - > - switch(kind) { > - case PyUnicode_1BYTE_KIND: expandsize = 4; break; > - case PyUnicode_2BYTE_KIND: expandsize = 6; break; > - case PyUnicode_4BYTE_KIND: expandsize = 10; break; > - } > + expandsize = kind * 2 + 2; > > if (len > PY_SSIZE_T_MAX / expandsize) > return PyErr_NoMemory(); > > -- > Repository URL: http://hg.python.org/cpython _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com