[Numpy-svn] r3743 - trunk/numpy/core/src
numpy-svn at scipy.org
numpy-svn at scipy.org
Thu May 10 18:42:52 EDT 2007
Author: oliphant
Date: 2007-05-10 17:42:48 -0500 (Thu, 10 May 2007)
New Revision: 3743
Modified:
trunk/numpy/core/src/arrayobject.c
trunk/numpy/core/src/multiarraymodule.c
Log:
Fix ticket #514 (and probably others) due to inappropriate fixing of largest string type on common type conversion.
Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c 2007-05-10 21:49:22 UTC (rev 3742)
+++ trunk/numpy/core/src/arrayobject.c 2007-05-10 22:42:48 UTC (rev 3743)
@@ -6937,15 +6937,13 @@
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);
Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c 2007-05-10 21:49:22 UTC (rev 3742)
+++ trunk/numpy/core/src/multiarraymodule.c 2007-05-10 22:42:48 UTC (rev 3743)
@@ -2153,7 +2153,8 @@
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 @@
if (mps[i] == NULL) goto fail;
}
Py_DECREF(intype);
- Py_XDECREF(stype);
+ Py_XDECREF(stype);
return mps;
fail:
More information about the Numpy-svn
mailing list