添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

This issue tracker has been migrated to GitHub , and is currently read-only .
For more information, see the GitHub FAQs in the Python's Developer Guide.

IMHO, now we can remove array.fromstring. For my research, there is no usage on the standard library. I 'd like to propose that let's remove array.fromstring from 3.9
For whom are interested in this issue,
Please wait until the core developer decides to approve this issue. :)
After that, we can review the PR for this issue.
Thank you for understanding.
Thoughts:
* The tostring() method should be handled in the same way.
* Remediation is easy because from_bytes() is a alias
* Still, all removals cause disruption from at least some users
* The only real benefit of removing it is a sense of tidiness;
  otherwise, there's no harm to keeping it (it's not broken).
* 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.
> there's no harm to keeping it (it's not broken)
... for now. :) There's always the risk that will change if we keep the code around.
> 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.
If the function is left then I agree it should probably be updated to match the rest of the module.
> 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 agree,
How about note it in the documentation and logging rather than removing them?
> If it was documented as deprecated and raising a deprecation warning then 3.2 is definitely far enough back to warrant removing it.
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:
https://mail.python.org/archives/list/[email protected]/thread/BRA7G4UIGGW2X7YY55KQZBOGJEYNUV6O/
New changeset 0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3 by Victor Stinner in branch 'master': bpo-38916 : array.array: remove fromstring() and tostring() ( GH-17487 ) https://github.com/python/cpython/commit/0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3
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.
New changeset 0381ea79ac2da03179c8512c581cac588b69cff9 by Victor Stinner in branch '3.8': bpo-38916 : Document array.array deprecation ( GH-17523 ) https://github.com/python/cpython/commit/0381ea79ac2da03179c8512c581cac588b69cff9 New changeset 21e11383cc59146184da0d69a3f19f004215f9a7 by Miss Islington (bot) in branch '3.7': bpo-38916 : Document array.array deprecation ( GH-17523 ) https://github.com/python/cpython/commit/21e11383cc59146184da0d69a3f19f004215f9a7
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')
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.
2022-04-11 14:59:23adminsetgithub: 83097 2019-12-09 13:58:48vstinnersetstatus: open -> closed
title: Remove array.fromstring -> Remove array.fromstring() and array.tostring() aliases, deprecated since Python 3.2
messages: + msg358089

resolution: fixed
stage: patch review -> resolved 2019-12-09 13:52:11miss-islingtonsetnosy: + miss-islington
messages: + msg358087
2019-12-09 13:47:02miss-islingtonsetpull_requests: + pull_request17003 2019-12-09 13:46:37vstinnersetmessages: + msg358084 2019-12-09 13:16:14vstinnersetmessages: + msg358073 2019-12-09 13:15:22vstinnersetpull_requests: + pull_request17001 2019-12-09 13:09:37vstinnersetmessages: + msg358072 2019-12-06 19:22:57vstinnersetmessages: + msg357941 2019-12-06 17:52:50vstinnersetmessages: + msg357933 2019-12-06 17:50:30vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request16966 2019-12-06 17:43:46vstinnersetmessages: + msg357932 2019-11-28 17:25:46brett.cannonsetmessages: + msg357623 2019-11-28 05:39:07corona10setmessages: + msg357601 2019-11-27 17:59:20brett.cannonsetmessages: + msg357576 2019-11-26 22:51:08rhettingersetnosy: + rhettinger
messages: + msg357538
2019-11-26 19:51:23brett.cannonsetmessages: + msg357527 2019-11-26 19:10:20brett.cannonsetmessages: + msg357524 2019-11-26 14:13:51corona10setnosy: + brett.cannon
2019-11-26 14:13:26corona10setmessages: + msg357497 2019-11-26 14:10:49corona10setkeywords: + easy (C) 2019-11-26 14:10:33corona10setmessages: + msg357496 2019-11-26 14:08:48corona10create