Hi there,

Revision 50 changed the following line in

122: ['sfixed32', decoder.Decoder.ReadSFixed32, -1,
      'ReadLittleEndian32', 0xffffffff],

(in testReadScalars). The change is going from the above “-1” to
“long(-1)”. While this passes ok on i386, it fails on amd64:

i386: result is <type 'long'>, expected is <type 'long'>
amd64: result is <type 'int'>, expected is <type 'long'>

I don't understand exactly what's going on, but I think the problem is
that an i386 system cannot represent that constant as int, but amd64 can
(not sure why...):
$ python32 -c 'print type(0xffffffff)'
<type 'long'>
$ python64 -c 'print type(0xffffffff)'
<type 'int'>

Of course, just reverting the 'long(-1)' change makes the test fail on

So, is this a genuine failure in the code, or is it just a bad unittest
that I can workaround by changing 0xffffffff to long(0xffffffff)?

I'm thinking of applying this patch in order to make the tests pass on
both platforms:

$ svn diff
Index: python/google/protobuf/internal/decoder_test.py
--- python/google/protobuf/internal/decoder_test.py     (revision 64)
+++ python/google/protobuf/internal/decoder_test.py     (working copy)
@@ -120,7 +120,7 @@
         ['fixed64', decoder.Decoder.ReadFixed64, 0xffffffffffffffff,
         'ReadLittleEndian64', 0xffffffffffffffff],
         ['sfixed32', decoder.Decoder.ReadSFixed32, long(-1),
-         'ReadLittleEndian32', 0xffffffff],
+         'ReadLittleEndian32', long(0xffffffff)],
         ['sfixed64', decoder.Decoder.ReadSFixed64, long(-1),
          'ReadLittleEndian64', 0xffffffffffffffff],
         ['float', decoder.Decoder.ReadFloat, 0.0,


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to