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
Attempt to fix Python 3.9 compatibility issue with array.array tostring/fromstring methods #1054
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ng method Python 3.2 removed the `array.array` `tostring` method (see https://docs.python.org/3/whatsnew/3.9.html#removed). Note that the `tostring` method was already deprecated since Python 3.2, but an alias to the new `tobytes` was provided (see https://docs.python.org/3/library/array.html#array.array.tobytes). This PR: - Adds helper function to use `tostring` in Python <3.2 versions and `tobytes` in Python>=3.2. - Replaces uses of `tostring` with the new helper function.
martingalloar
added
the
enhancement
Implemented features can be improved or revised
label
Apr 14, 2021
martingalloar
changed the title
Attempt to fix Python 3.9 compatibility issue with array.array tostring method
Attempt to fix Python 3.9 compatibility issue with array.array tostring/fromstring methods
Apr 14, 2021
0xdeaddood
approved these changes
Apr 19, 2021
martingalloar
added a commit
that referenced
this pull request
Apr 19, 2021
While reviewing #1054, we found that ping examples where using old strings instead of bytes as payloads, and this is breaking in Python >2.
martingalloar
added a commit
that referenced
this pull request
Apr 19, 2021
Small change for properly use the array_tobytes function.
Merged
martingalloar
added a commit
that referenced
this pull request
Apr 19, 2021
After working on #1054 and moving to use frombytes/tobytes we found a Python 3 compat issue with bytes/string in PacketBuffer __validate_index. This fixes a wrong use of a string instead of bytes.
martingalloar
added a commit
that referenced
this pull request
Apr 19, 2021
After working on #1054 and moving to use frombytes/tobytes we found a Python 3 compat issue with bytes/string in PacketBuffer __validate_index. This fixes a wrong use of a string instead of bytes.
martingalloar
added a commit
that referenced
this pull request
Apr 19, 2021
While reviewing #1054, we found that ping examples where using old strings instead of bytes as payloads, and this is breaking in Python >2.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Python 3.9 removed the
array.array
tostring
andfromstring
methods (see https://docs.python.org/3/whatsnew/3.9.html#removed).Note that the
tostring
andfromstring
methods were already deprecated since Python 3.2, but aliases to the newtobytes
andfrombytes
were provided (see https://docs.python.org/3/library/array.html#array.array.tobytes).This PR:
tostring
andfromstring
in Python <3.2 versions andtobytes
andfrombytes
in Python>=3.2.tostring
andfromstring
with the new helper function.This should help close #1032. Based on #992, should close also duplicated #946 with the exception of the remaining change for
isAlive
.