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
The better approach would be something along the lines of:
if isinstance(msg, bytes):
# Already provided as bytes, nothing to do
else:
# Provided as something else than bytes, convert to bytes
And even that is not ideal, because there are still corner cases where the receiver gets something different than the sender sent.
A better option could be to use pickle to serialize messages on-the-wire.
I know it is "not safe" to unpickle messages received on-the-wire from an untrusted source, but it's probably good enough for simulations.
The pickling and unpickling could be done inside sendClassical and recvClassical, or the burden could be put on the application and sendClassical and recvClassical could insist on only getting messages of type bytes.
The former is more convenient for the application, the latter gives the application their own choice of serialization method (including the option of using something more safe than pickle).
@AckslD Feel free to assign to me. I can fix the issue and generate a pull request.
The text was updated successfully, but these errors were encountered:
Same here (as in #58): I will take a shot at fixing the issues, cleaning up the code, and getting to better performance in the process. Expect pull request to review, hopefully within the next week or two.
Say Alice calls sendClassical with msg = b'01' (= two bytes, first character 0 = ASCII 48, second character 1 = ASCII 49).
When Bob calls recvClassical it receives a different msg = b'\x01' (= one byte, value 1).
This is because of the following piece of code:
You can see that:
The better approach would be something along the lines of:
And even that is not ideal, because there are still corner cases where the receiver gets something different than the sender sent.
A better option could be to use pickle to serialize messages on-the-wire.
I know it is "not safe" to unpickle messages received on-the-wire from an untrusted source, but it's probably good enough for simulations.
The pickling and unpickling could be done inside sendClassical and recvClassical, or the burden could be put on the application and sendClassical and recvClassical could insist on only getting messages of type bytes.
The former is more convenient for the application, the latter gives the application their own choice of serialization method (including the option of using something more safe than pickle).
@AckslD Feel free to assign to me. I can fix the issue and generate a pull request.
The text was updated successfully, but these errors were encountered: