Skip to content

Pickling a Betterproto message #419

@tijs2

Description

@tijs2

Hi,

I have found an issue when I wanted to use this library in combination with multiprocessing/pickling.
I am using version 2.0.0b5

When the resulting message is send back by one of my running processes with the map function it changes empty values and also when I only run pickle they are changed.

The message:

syntax = "proto3";

message TestMessage {
    string value = 1;
}

To code:

test_message = TestMessage()
print(test_message)
pickled = pickle.dumps(test_message)
unpickled = pickle.loads(pickled)
print(pickle.loads(pickled))
print(unpickled.value)
print(type(unpickled.value))

The output:

TestMessage()
TestMessage(value=<object object at 0x7febf0791fe0>)
<object object at 0x7fd9ef242ff0>
<class 'object'>

So it seems it adds an object instead of an empty value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions