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

New issue 261 by klep...@gmail.com: [Python] new cpp support does not namespace protobuf messages
http://code.google.com/p/protobuf/issues/detail?id=261

What steps will reproduce the problem?
1. Create two protocol files that have a message with the same name. Or just the same protocol copied to two different files.

2. Compile them with protoc using the new experimental cpp python support.

3. Try to import the two pb2 files into the same interpreter.

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

With the pure python support this works, because the protocols are in different modules. With new experimental cpp support you get:

libprotobuf ERROR google/protobuf/descriptor.cc:2237] Invalid proto descriptor for file "test2.proto": libprotobuf ERROR google/protobuf/descriptor.cc:2240] Message.test: "Message.test" is already defined in file "test1.proto". libprotobuf ERROR google/protobuf/descriptor.cc:2240] Message: "Message" is already defined in file "test1.proto".

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

protobuf-2.4.0a on Ubuntu 10.04 LTS

Please provide any additional information below.

The above suggests there is some kind of shared state between the different protocol modules. This was somewhat tricky to find since the error only occurs once you load *two* protobuf files into the same process.

As for solutions I see either:
- Not sharing whatever it is that is being shared.
- Automatically using the module name to namespaces the messages and so distinguish messages in different modules.

A quick browse of the source suggest it might be the descriptor pool that is shared. Maybe the pool should be associated with the FileDescriptor object instead? (unless there is some reason you can't have more than one pool).

--
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 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to