Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5de0b6e

Browse files
committed
Add fix to unit test; remove debug logging
Add check to see if 12 bytes is a valid size for a long double
1 parent d0aca0e commit 5de0b6e

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

numpy/core/src/multiarray/conversion_utils.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,19 +1116,9 @@ PyArray_TypestrConvert(int itemsize, int gentype)
11161116
* This should eventually be changed to an error in
11171117
* future NumPy versions.
11181118
*/
1119-
1120-
if (newtype == NPY_NOTYPE)
1121-
{
1122-
printf("XXX: gentype=%c\n", gentype);
1123-
}
11241119
if (newtype == NPY_NOTYPE) {
11251120
temp = PyArray_DescrFromType(gentype);
1126-
1127-
if (gentype == 'g')
1128-
printf("XXX: temp=%x\n", temp);
11291121
if (temp != NULL) {
1130-
if (gentype == 'g')
1131-
printf("XXX: elsize=%d itemsize=%d\n", temp->elsize, itemsize);
11321122
if (temp->elsize != itemsize) {
11331123
if (DEPRECATE(msg) < 0) {
11341124
Py_DECREF(temp);

numpy/core/tests/test_dtype.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ def test_invalid_types(self):
6060
assert_warns(DeprecationWarning, np.dtype, 'I5')
6161
assert_warns(DeprecationWarning, np.dtype, 'e3')
6262
assert_warns(DeprecationWarning, np.dtype, 'f5')
63-
assert_warns(DeprecationWarning, np.dtype, 'g12')
63+
64+
if np.dtype('g').itemsize == 8 or np.dtype('g').itemsize == 16:
65+
assert_warns(DeprecationWarning, np.dtype, 'g12')
66+
elif np.dtype('g').itemsize == 12:
67+
assert_warns(DeprecationWarning, np.dtype, 'g16')
6468

6569
if np.dtype('l').itemsize == 8:
6670
assert_warns(DeprecationWarning, np.dtype, 'l4')

0 commit comments

Comments
 (0)