Skip to content

Replaces use of numpy's tostring() with tobytes()#1024

Merged
jswhit merged 2 commits into
Unidata:masterfrom
pacificclimate:fix/1023
Jul 7, 2020
Merged

Replaces use of numpy's tostring() with tobytes()#1024
jswhit merged 2 commits into
Unidata:masterfrom
pacificclimate:fix/1023

Conversation

@jameshiebert
Copy link
Copy Markdown
Contributor

@jameshiebert jameshiebert commented Jul 3, 2020

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.

Fixes #1023

I haven't done extensive testing, but the test suite runs fine on my dev machine:

(venv) james@basalt:~/code/git/netcdf4-python/test$ python run_all.py 
not running tst_unicode.py ...
not running tst_create_mem.py ...
not running tst_cdf5.py ...

netcdf4-python version: 1.5.4
HDF5 lib version:       1.10.0
netcdf lib version:     4.6.0
numpy version           1.19.0
cython version          0.29.20
......../home/james/code/git/netcdf4-python/test/tst_types.py:92: UserWarning: WARNING: missing_value not used since it
cannot be safely cast to variable data type
  assert_array_equal(v3[:],-1*np.ones(n2dim,v3.dtype))
..................................................................................foo_bar
.
----------------------------------------------------------------------
Ran 91 tests in 4.479s

OK

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.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jul 3, 2020

CLA assistant check
All committers have signed the CLA.

@jswhit
Copy link
Copy Markdown
Collaborator

jswhit commented Jul 6, 2020

Looks good thanks - could you just add a Changelog entry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Method numpy.ndarray.tostring() is deprecated in favor of tobytes() in 1.9

3 participants