From b9f9cbfde5defb6e350284ff91e9ee6605dbe53d Mon Sep 17 00:00:00 2001 From: aleju Date: Tue, 13 Aug 2019 21:18:48 +0200 Subject: BUG: Fix formatting error in exception message This commit fixes a simple formatting error in the generation of an exception message. The message is supposed to contain the expected vs. the actual dtype, but instead contained two times the expected dtype. --- numpy/random/common.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy') diff --git a/numpy/random/common.pyx b/numpy/random/common.pyx index 6ad5f5b21..b2f24be7d 100644 --- a/numpy/random/common.pyx +++ b/numpy/random/common.pyx @@ -227,7 +227,7 @@ cdef check_output(object out, object dtype, object size): raise ValueError('Supplied output array is not contiguous, writable or aligned.') if out_array.dtype != dtype: raise TypeError('Supplied output array has the wrong type. ' - 'Expected {0}, got {0}'.format(dtype, out_array.dtype)) + 'Expected {0}, got {1}'.format(dtype, out_array.dtype)) if size is not None: try: tup_size = tuple(size) -- cgit v1.2.1 From 6e412490ce27ac6b528e49a44b7c1c5bf29622db Mon Sep 17 00:00:00 2001 From: aleju Date: Tue, 13 Aug 2019 22:12:14 +0200 Subject: MAINT: Improve error message dtype appearance This changes the string conversion of an expected dtype in an error message from e.g. "" to "float64". --- numpy/random/common.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy') diff --git a/numpy/random/common.pyx b/numpy/random/common.pyx index b2f24be7d..74cd5f033 100644 --- a/numpy/random/common.pyx +++ b/numpy/random/common.pyx @@ -227,7 +227,7 @@ cdef check_output(object out, object dtype, object size): raise ValueError('Supplied output array is not contiguous, writable or aligned.') if out_array.dtype != dtype: raise TypeError('Supplied output array has the wrong type. ' - 'Expected {0}, got {1}'.format(dtype, out_array.dtype)) + 'Expected {0}, got {1}'.format(np.dtype(dtype), out_array.dtype)) if size is not None: try: tup_size = tuple(size) -- cgit v1.2.1