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
Update to Python 3.9 #1690
Update to Python 3.9 #1690
Conversation
Fix AttributeError: 'array.array' object has no attribute 'fromstring'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mikacousin . Good spot.
I've updated your PR to target the 0.10 branch. We work in the master/0.x branches and just generate the 0.x.y branches at release for historical reasons.
Would you be interested in adding a test of one or both of these functions to ClientWrapperTest.py in the same way as @brucelowekamp did in there and RDMTest.py as it seems this issue slipped through the net due to having no equivalent test for these functions.
I'm sorry but I don't master ola and python enough to write those tests. Shame on me, but I still have a lot to learn :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I hate these if version things, though. Would this work with just:
data = array.array('B', request.data)
?
@brucelowekamp : Just tested with python 3.9, it works and it's more elegant. |
@peternewman It would definitely be a bit challenging to write the tests, though I think the socket mock could do it. I don't have time for now. IMHO it would be better to merge this with a TODO to write tests for it. I believe the change should work on python2 and python3. |
I think you've already done it with the RDM ones that send and receive data @brucelowekamp . I was actually going to try and knock one together and see if @mikacousin or you could test it instead but I keep getting sidetracked today. |
Hmm, I thought I'd covered this test in c402fcb but it's still passing on Python 3.7 which it looks like it shouldn't from the docs, so I guess I've not tested quite the right bit... |
Okay I'm really confused now, because a local run with some print statements proves it is running the array code in my test. @mikacousin could you give that commit/my branch a test on your machine please? |
No problem, compiling now your clang-latest branch.
Do you need more tests ? PS: If I remove fromstring in OlaClient.py, |
That's perfect thanks @mikacousin . Sorry I was thrown by it working in 3.7 but not in 3.9, but having read more carefully I see it was deprecating in 3.2 and dropped in 3.9. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @mikacousin . Works in reality, passes my new tests, what's not to like!
Force merging as we've got some outstanding Travis issues which will be fixed in another PR by me, no point holding this one up. |
@brucelowekamp I assume you don't have a nicer way you'd prefer to do this bit which we should ask @mikacousin nicely to test on a machine with 3.9?: Lines 949 to 952 in 7090ab2
|
not that I know of. problems with renaming methods across releases... |
Okay thanks. Yeah this Python 3 thing has certainly been painful in terms of migration. Although I guess things like libmicrohttpd didn't do much better either. |
Fix AttributeError: 'array.array' object has no attribute 'fromstring'