-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
DEP: Deprecate ndarray.tostring() #15867
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
Conversation
6b2f93e
to
df2b896
Compare
df2b896
to
c3a245c
Compare
I guess it's time indeed..... Could you do the same for Would be good to mention on the mailing list, not sure if anyone still relies on it. |
Done in the commit I posted just before you sent that
Not sure it's even worth it. Unless they're trying to support numpy from 1.19 all the way back to 1.8, the fix is trivial. Even if they do somehow care about such an old version, the cost of not fixing it is simply a warning. |
Even just as a heads up, we should always mention deprecations on the list. There's lots of projects where this could fail their CI as soon as we either merge or release this. |
Done in http://numpy-discussion.10968.n7.nabble.com/Deprecating-ndarray-tostring-td48010.html, also made the necessary changes in scipy and matplotlib myself. |
ndarray.tostring will be deprecated in Numpy 1.19 numpy/numpy#15867
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.
LGTM, a quick deprecation test would be better though, since I guess the tostring
function(s) are actually be fully non-covered now.
Looks like I forgot to commit the one I wrote |
c3a245c
to
9c7c60c
Compare
The corresponding `array.array.tostring()` in the standard library has been deprecated in favor of `tobytes` since Python 3.1 (python/cpython@1ce3eb5).
9c7c60c
to
7668a33
Compare
Despite its name, it returns `bytes` not `str`\ s. | ||
|
||
.. deprecated:: 1.19.0 | ||
""")) |
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.
Do we need to include the parameters, return and example to this docstring ? I see other deprecated functions in the code base where this information is present.
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.
I'd argue in this case there's no point, as the functions are completely identical.
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.
This will still have a slight impact on users continuing to use the deprecated tostring and calling help on tostring instead of tobytes (probably just making them run an addition help on tobytes).
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.
Not sure, but then it is identical and not having a full documentation means that you cannot overread the "deprecated" note, so I think I am happy with it.
Tested the ma and scalars manually, so OK with this (the C-code needs the test the most). Will probably just merge later (and leave release notes formatting, if wished, for release time).
``numpy.ndarray.tostring()`` is deprecated in favor of ``tobytes()`` | ||
-------------------------------------------------------------------- | ||
`~numpy.ndarray.tobytes` has existed since the 1.9 release, but until this release `~numpy.ndarray.tostring` emitted no warning. | ||
The change to emit a warning brings NumPy in line with the builtin `array.array` methods of the same name. |
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.
should be reflowed to 80 columns
Thanks @eric-wieser |
numpy has deprecated the use of array.array.tostring() in favor of tobytes numpy/numpy#15867 This patch replaces all (6) such uses in this package.
The corresponding
array.array.tostring()
in the standard library has been deprecated in favor oftobytes
since Python 3.1 (python/cpython@1ce3eb5).