[Python-Dev] Re: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.204, 2.205 (original) (raw)

M.-A. Lemburg mal at egenix.com
Fri Dec 19 05🔞28 EST 2003


Hye-Shik Chang wrote:

On Fri, Dec 19, 2003 at 09:30:27AM +0100, M.-A. Lemburg wrote:

perky at users.sourceforge.net wrote:

Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv1651/Objects

Modified Files: unicodeobject.c Log Message: SF #859573: Reduce compiler warnings on gcc 3.2 and above. Index: unicodeobject.c *************** *** 2204,2208 **** /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ ! if (size == 1 && (unsigned char)s < 256) { PyUNICODE r = (unsigned char)s; return PyUnicodeFromUnicode(&r, 1); --- 2212,2216 ---- /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ ! if (size == 1) { PyUNICODE r = (unsigned char)s; return PyUnicodeFromUnicode(&r, 1); This "fix" doesn't look right. Please check. gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPyBUILDCORE -o Objects/unicodeobject.o Objects/unicodeobject.c Objects/unicodeobject.c: In function `PyUnicodeUCS2DecodeLatin1': Objects/unicodeobject.c:2214: warning: comparison is always true due to limited range of data type AFAIK, (unsigned char)s is always smaller than 256. Also decoding latin-1 can be done by just casting it into PyUNICODE.

You are right. I was thinking that there was some reason we needed this to get Unicode working on Crays, but looking at the CVS log, this was probably just the result of adjusting Martin's single character sharing code to work for Latin-1 rather than just ASCII characters.

-- Marc-Andre Lemburg eGenix.com

Professional Python Services directly from the Source (#1, Dec 19 2003)

Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/


::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the Python-Dev mailing list