diff options
author | zjpoh <poh.zijie@gmail.com> | 2019-08-19 22:03:25 -0700 |
---|---|---|
committer | zjpoh <poh.zijie@gmail.com> | 2019-08-19 22:03:25 -0700 |
commit | f779af07a92cb419b964316960a1b503df9b712d (patch) | |
tree | cd358ddb5f5540907b5f623154187992789ed3ef | |
parent | b112fc371815fbd1fa5e1f121ffee9aa563092f1 (diff) | |
download | numpy-f779af07a92cb419b964316960a1b503df9b712d.tar.gz |
Add parenthesis as suggested by compiler. Update docstring.
-rw-r--r-- | numpy/core/_add_newdocs.py | 7 | ||||
-rw-r--r-- | numpy/core/src/multiarray/arraytypes.c.src | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_longdouble.py | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py index f041e0cd6..033e3809c 100644 --- a/numpy/core/_add_newdocs.py +++ b/numpy/core/_add_newdocs.py @@ -1032,7 +1032,12 @@ add_newdoc('numpy.core.multiarray', 'fromstring', A string containing the data. dtype : data-type, optional The data type of the array; default: float. For binary input data, - the data must be in exactly this format. + the data must be in exactly this format. Supported dtypes are + byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, + datetime, timedelta, float, double, longdouble, half, bool, + cfloat, and cdouble. + + Complex dtypes are only supported since numpy 1.18.0 count : int, optional Read this number of `dtype` elements from the data. If this is negative (the default), the count will be determined from the diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index 98939637c..53dfe7ca7 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -1862,7 +1862,7 @@ static int @type@ output; - if (endptr && (*endptr[0] == '+') || (*endptr[0] == '-')) { + if (endptr && ((*endptr[0] == '+') || (*endptr[0] == '-'))) { // Imaginary component specified output.real = result; diff --git a/numpy/core/tests/test_longdouble.py b/numpy/core/tests/test_longdouble.py index ad4d7a357..7fb542ee1 100644 --- a/numpy/core/tests/test_longdouble.py +++ b/numpy/core/tests/test_longdouble.py @@ -71,7 +71,7 @@ def test_fromstring(): def test_fromstring_complex(): - for ctypes in ["cdouble", "cfloat"]: + for ctypes in ["complex", "cdouble", "cfloat"]: # Check spacing between separator assert_equal(np.fromstring("1, 2 , 3 ,4",sep=",",dtype=ctypes), np.array([1., 2., 3., 4.])) |