Python 2.2 chr representation errors with embedded C

Hello, I have recently made the upgrade to Python 2.2 from 1.5.2. In the Python application which I develop, we have several embedded C functions, one of which is a simple function to convert a hex string to octal--it simply chars each byte and returns the new buffer. However, I have noticed a 0.01% error rate in Python 2.2 which I did not see in Python 1.5.2 (it was 100% accurate). That is, 1 out of 10,000 hex strings will be converted incorrectly in the C function, usually one byte is returned as \x00 instead of what is should be. I also have noticed that in Python 2.2, chr(0xff) returns \xff instead of \377 in Python 1.5.2. Could this be the source of the communication breakdown? I should mention that writing a similar conversion function totally in Python is 100% accurate in Python 2.2 as well as Python 1.5.2, although it is an order of magnitude slower. Any information about the apparent source of this issue would be appreciated! Thanks, Mark

"Mark Szigety" <mszigety@cisco.com> writes:
Any information about the apparent source of this issue would be appreciated!
I guess there is a bug in your code. Please don't use python-dev to discuss it. If you have been using repr internally: yes, there result of representing a string has changed from 1.5.2 to 2.2. Regards, Martin
participants (2)
-
Mark Szigety
-
martin@v.loewis.de