I am trying to parallelize a protobuf application one instance in each thread, but I am getting this error
/usr/local/lib/python3.10/dist-packages/google/protobuf/internal/containers.py", line 250, in __reduce__
raise pickle.PickleError("Can't pickle repeated scalar fields, convert to list first")
I compiled protobuf
./configure CPPFLAGS="-DGOOGLE_PROTOBUF_NO_THREAD_SAFETY"
the error comes from reduce function.
def __reduce__(self, **kwargs) -> NoReturn:
# Convert repeated scalar fields to lists
raise pickle.PickleError("Can't pickle repeated scalar fields, convert to list first")
def add(self, **kwargs: Any) -> _T:
"""Adds a new element at the end of the list and returns it. Keyword
arguments may be used to initialize the element.
"""
new_element = self._message_descriptor._concrete_class(**kwargs)
new_element._SetListener(self._message_listener)
self._values.append(new_element)
if not self._message_listener.dirty:
self._message_listener.Modified()
return new_element