Wow we submitted the same bug 6 minutes off of each other.
The test also passes with a fix by changing long(-1) to -1 on the line
above.  I'm not sure which change is the 'correct' one.

Frank

On Oct 5, 2:41 am, Iustin Pop <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> Revision 50 changed the following line in
> python/google/protobuf/internal/decoder_test.py:
>
> 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
> i386.
>
> 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,
>
> regards,
> iustin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to