-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String/Bytes fix #270
String/Bytes fix #270
Conversation
Can confirm, works with python 2. |
Except note the Travis CI failure with Python 2 - |
8645351
to
e52c8af
Compare
e52c8af
to
0e16e25
Compare
1d340d1
to
1e8f3b0
Compare
1e8f3b0
to
3f39f35
Compare
Actually sending the test string via AMS works in 2 & 3, using Receiving doesn't work in 2 (but does in 3).
|
Oh, I should test dirq sending rather than just directory, as the former was reported as the issue in #270. |
Ok, adding UTF-8 into the mix here was hiding the issue that the original tickets reported. And testing using The problem is the lack of strict encoding and decoding at the program boundaries. This does also mean that there's a choice to make about codec to use, but need to be careful not to break the APEL loader. |
Resolves #146
Resolves #209
The PR adds a new test which sends bytestrings through on_message, and through the test isolated two different issues with bytestring handling:
In _handle_msg, the string comparison with 'in' would trigger a byte-not-str error,
In _save_msg_to_queue, errors would be caught by the IO/OS error handler, but removing that showed that the raw bytestring from 'body' was being placed into Dirq which handled it as if it was a string causing a decode error.
Our Dirq schemas suggest that we only want strings in this point. I added a ducktype test that solves both problems in _save_msg_to_queue.