You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using protobuf extensions ("google.protobuf.MessageOptions" and "google.protobuf.FieldOptions") an AssertionError is caused when two modules (in the same process) directly or indirectly import a "_pb2.py" that uses these options. The code in the "_pb2.py" file try to register the extension. Since two modules are importing these extensions then there are two registrations attempt made by the "*_pb2.py" file resulting in an exception in the python/google/protobuf/internal/python_message.py fileas follows:
AssertionError: Extensions "voltha.yang_child_rule" and "voltha.yang_child_rule" both try to extend message type "google.protobuf.MessageOptions" with field number 60000.
Commenting out the assertion error seems to be ok. I locally commented it out as :
def _AddStaticMethods(cls):
TODO(robinson): This probably needs to be thread-safe(?)
# Try to insert our extension, failing if an extension with the same number
# already exists.
actual_handle = cls._extensions_by_number.setdefault(
extension_handle.number, extension_handle)
if actual_handle is not extension_handle:
return
# raise AssertionError(
# 'Extensions "%s" and "%s" both try to extend message type "%s" with '
# 'field number %d.' %
# (extension_handle.full_name, actual_handle.full_name,
# cls.DESCRIPTOR.full_name, extension_handle.number))
cls._extensions_by_name[extension_handle.full_name] = extension_handle
This issue seems to have been fixed but there is no release available yet. I am using libprotobuf 3.0.9
The text was updated successfully, but these errors were encountered:
When using protobuf extensions ("google.protobuf.MessageOptions" and "google.protobuf.FieldOptions") an AssertionError is caused when two modules (in the same process) directly or indirectly import a "_pb2.py" that uses these options. The code in the "_pb2.py" file try to register the extension. Since two modules are importing these extensions then there are two registrations attempt made by the "*_pb2.py" file resulting in an exception in the python/google/protobuf/internal/python_message.py fileas follows:
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(yang_child_rule)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", line 766, in RegisterExtension
cls.DESCRIPTOR.full_name, extension_handle.number))
AssertionError: Extensions "voltha.yang_child_rule" and "voltha.yang_child_rule" both try to extend message type "google.protobuf.MessageOptions" with field number 60000.
Commenting out the assertion error seems to be ok. I locally commented it out as :
def _AddStaticMethods(cls):
TODO(robinson): This probably needs to be thread-safe(?)
def RegisterExtension(extension_handle):
extension_handle.containing_type = cls.DESCRIPTOR
_AttachFieldHelpers(cls, extension_handle)
This issue seems to have been fixed but there is no release available yet. I am using libprotobuf 3.0.9
The text was updated successfully, but these errors were encountered: