Skip to content

Commit

Permalink
Fixed subtle bug that caused arrays of dtype elements to have the wrong
Browse files Browse the repository at this point in the history
shape.  [dtype(np.float64), dtype(np.float64)] should have shape (2,) but
had shape (2,0) and the wrong dtype of the array. This broke several tests
in the scipy.stats module.
  • Loading branch information
Jason McCampbell (Enthought, Inc) committed Apr 25, 2011
1 parent 91515c8 commit f635077
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions numpy/NumpyDotNet/NpyArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ internal static dtype FindArrayType(Object src, dtype minitype, int max = NpyDef
}
}
// TODO: PyInstance_Check?
if (src is IEnumerable<object>) {
if (src is IEnumerable<object> && !(src is dtype)) {
// TODO: This does not work for user-defined Python sequences
int l;
try {
Expand Down Expand Up @@ -688,7 +688,7 @@ private static int DiscoverDepth(Object src, int max,
}
}

if (src is IEnumerable<object>) {
if (src is IEnumerable<object> && !(src is dtype)) {
IEnumerable<object> seq = (IEnumerable<object>)src;
object first;
try {
Expand Down
2 changes: 0 additions & 2 deletions numpy/NumpyDotNet/ufunc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ public string __name__ {
}
}

// TODO: Implement 'identity'

public string signature() {
CheckValid();
IntPtr strPtr = Marshal.ReadIntPtr(core, NpyCoreApi.UFuncOffsets.off_core_signature);
Expand Down

0 comments on commit f635077

Please sign in to comment.