Status: New
Labels: Type-Defect Priority-Medium

New issue 261 by [Python] new cpp support does not namespace protobuf messages

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/] Invalid proto descriptor for file "test2.proto": libprotobuf ERROR google/protobuf/] Message.test: "Message.test" is already defined in file "test1.proto". libprotobuf ERROR google/protobuf/] 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
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to