diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-05-10 22:42:48 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-05-10 22:42:48 +0000 |
commit | 6d8010c4654cbc7e9a04495a4401548fa47e332c (patch) | |
tree | 53111cd2e262a883d9cf995206cc8f021e52a855 /numpy/core/src | |
parent | ae13dc354df5e58fb1417ba80fc9c85242224caf (diff) | |
download | numpy-6d8010c4654cbc7e9a04495a4401548fa47e332c.tar.gz |
Fix ticket #514 (and probably others) due to inappropriate fixing of largest string type on common type conversion.
Diffstat (limited to 'numpy/core/src')
-rw-r--r-- | numpy/core/src/arrayobject.c | 6 | ||||
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 3b8c71226..3e4e7f666 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -6937,15 +6937,13 @@ _array_small_type(PyArray_Descr *chktype, PyArray_Descr* mintype) else { outtype = PyArray_DescrFromType(outtype_num); } - if (PyTypeNum_ISEXTENDED(outtype->type_num) && \ - (PyTypeNum_ISEXTENDED(mintype->type_num) || \ - mintype->type_num==0)) { + if (PyTypeNum_ISEXTENDED(outtype->type_num)) { int testsize = outtype->elsize; register int chksize, minsize; chksize = chktype->elsize; minsize = mintype->elsize; /* Handle string->unicode case separately - because string itemsize is twice as large */ + because string itemsize is 4* as large */ if (outtype->type_num == PyArray_UNICODE && mintype->type_num == PyArray_STRING) { testsize = MAX(chksize, 4*minsize); diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index b06440c7f..3042a88b8 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -2153,7 +2153,8 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) else if ((stype != NULL) && (intypekind != scalarkind)) { \ /* we need to upconvert to type that handles both intype and stype - and don't forcecast the scalars. + + also don't forcecast the scalars. */ if (!PyArray_CanCoerceScalar(stype->type_num, @@ -2187,7 +2188,7 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) if (mps[i] == NULL) goto fail; } Py_DECREF(intype); - Py_XDECREF(stype); + Py_XDECREF(stype); return mps; fail: |