[Python-Dev] Re: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.197, 2.198

Tim Peters tim.one at comcast.net
Wed Sep 17 20:22:13 EDT 2003


[Tim]
>> Jeremy believed Py_UNICODE was already an unsigned type on his box,
>> and that was the box with the segfaults.  I don't know.  Comparison
>> with a signed int confused the issues to the point where we gave up
>> and just fixed it <wink>.

[M.-A. Lemburg]
> That sounds more like compiler bug to me.

It could be, but if so Jeremy is running on a mainstream Linux+gcc platform
and then it's something we can't really wish away.  Jeremy, can you tell us
what Py_UNICODE resolves to on your box, or give enough details so someone
else can figure it out?

As I read the C standard,

     unsigned_int < 256

has to use unsigned comparison, so it's a compiler bug, or I'm misreading
the standard, or Jeremy was mistaken in believing Py_UNICODE resolves to an
unsigned thingie on his box (we know for sure that the bit pattern
0xcdcdcdcd compared less than 256 on his box; that's obviously what it
should do if Py_UNICODE resolves to a signed 4-byte thing on his box, but
not otherwise).

> What's bothering me is that such compares are done in other places too,
> so a more general solution would be better.

I'd like to figure out what Jeremy's true problem was first -- we've got a
solution to his symptom now, but don't really know why it was necessary.




More information about the Python-Dev mailing list