Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 486 by mathieu....@gmail.com: Inconsistent parsed data from Python between Windows and Linux
http://code.google.com/p/protobuf/issues/detail?id=486

What steps will reproduce the problem?
1. Create a simple .proto file with an enum; eg test.proto:

message Response {
    enum StatusCode {
        SUCCESS_EMPTY = 0;
    }
    required StatusCode status_code = 1;
}

2. Generate Python bindings using protoc --python_out (protoco 2.5.0)

3. Run a simple script to parse a protobuf message:

from test import Response
r = Response.FromString("\x08\x00")
print "Code:", repr(r.status_code)
print "Enum:", repr(Response.SUCCESS_EMPTY)


What is the expected output? What do you see instead?

On "Windows":
Code: 0L
Enum: 0

On "Linux":
Code: 0
Enum: 0

The parsed .status_code field is a long in Windows, and an int in Linux. This causes problems for code that compares enum values with "is" rather than "=="; doing comparisons like that might not be the most advisable thing, but the inconsistency between Windows and Linux is still very strange here.


What version of the product are you using? On what operating system?

"Windows": Protobuf 2.5.0, Python 2.7.3 AMD64, Windows Server 2008 R2 (Version 6.1, Build 7601 SP1)

"Linux": Protobuf 2.5.0, Python 2.7.3 AMD64 (2.7.3-0ubuntu7).


Please provide any additional information below.

Inconsistency breaks client-side database drivers for RethinkDB in Windows, where "is" operator is used to compare values to enums.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to