-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Remove array.fromstring() and array.tostring() aliases, deprecated since Python 3.2 #83097
Comments
array.fromstring was deprecated at 3.2 IMHO, now we can remove array.fromstring. |
I'd like to tag this issue as an easy issue. |
For whom are interested in this issue, Thank you for understanding. |
If it was documented as deprecated and raising a deprecation warning then 3.2 is definitely far enough back to warrant removing it. |
Although I will admit we have not had a discussion on python-dev about removing stuff that was left for Python 2.7 compatibility, so that discussion should probably occur first before we go ripping stuff out. |
Thoughts:
|
... for now. :) There's always the risk that will change if we keep the code around.
If the function is left then I agree it should probably be updated to match the rest of the module. |
I agree, |
Yep, docs and raising DeprecationWarning should be good. |
Exactly. I'm in favor of removing fromstring() and tostring() methods right now, and update 3.7 and 3.8 documentation to mention that the methods are removed in Python 3.9, not Python 4.0. Either do it right now, or wait the beginning of the next Python 3.x release cycle. I prefer to push some incompatible changes at the beginning of dev cycles, to get enough time to measure the feedback from users. -- Brett opened a more generic discussion about the deprecation process, since PEP-602 has been accepted: |
I chose to write PR 17487 even if the issue was tagged as "easy (C)", just to make sure that the change is done as soon as possible in the 3.9 dev cycle. |
Brett Cannon: "If it was documented as deprecated and raising a deprecation warning then 3.2 is definitely far enough back to warrant removing it." I understood that Brett is in favor of removing it. Raymond Hettinger: "The tostring() method should be handled in the same way." Done. Raymond Hettinger: "Remediation is easy because from_bytes() is a alias" For code supporting Python 2 and Python 3, it may be annoying, but Python 3.9 will only be released after Python 2 support will end. So I consider that it's an acceptable annoyance. Users can put "if six.PY3" in their code or don't support Python 3.9. Raymond Hettinger: "Still, all removals cause disruption from at least some users" I'm perfectly aware of that. But I consider that it's worth it. I chose to push my change early in the 3.9 development cycle, to get users feedback earlier. So we can still revert the change if they are too many complains. Raymond Hettinger: "The other deprecation in the array module says, "Deprecated since version 3.3, will be removed in version 4.0". Perhaps this one should have had the same qualifier." I proposed PR 17523 to document that tostring() and fromstring() deprecated aliases will be removed in Python 3.9. |
The aliases were deprecated since Python 3.2. It's now time to use the newer names. array.array.fromstring() implictly converted Unicode to UTF-8: $ python3
Python 3.7.5 (default, Oct 17 2019, 12:16:48)
>>> import array
>>> a=array.array('B')
>>> a.fromstring('€uro')
>>> a
array('B', [226, 130, 172, 117, 114, 111])
>>> list('€uro'.encode('utf8'))
[226, 130, 172, 117, 114, 111] The removal is now documented in 3.7 and 3.8. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: