summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2011-03-08 10:21:25 -0700
committerCharles Harris <charlesr.harris@gmail.com>2011-03-08 10:21:25 -0700
commitcef500872547ba3f06f42a8669c7c72382451822 (patch)
tree702dd763b5291bc605cf0f0a6f2b90ed1ad4e287 /numpy
parent90e4cf055c8b469634cdb6c84e0a8843c2212e78 (diff)
downloadnumpy-cef500872547ba3f06f42a8669c7c72382451822.tar.gz
DOC: Improve the content of a comment.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/ctors.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index e0d698781..e2af0dab4 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -824,11 +824,13 @@ discover_dimensions(PyObject *s, int *maxndim, npy_intp *d, int check_it,
if ((e = PySequence_GetItem(s, 0)) == NULL) {
/*
- * This should probably be an error but we suppress
- * it to maintain backwards compatibility with pandas
- * and possibly other existing applications. The making
- * of the object type instead of a straght return might
- * cause other errors not to occur.
+ * PySequence_Check looks for the presence of the __getitem__
+ * attribute to detect a sequence. Consequently, dictionaries
+ * and other objects that implement that method may show up
+ * here and the PySequence_GetItem call can fail in those
+ * cases. Consequently we truncate the dimensions and set the
+ * object creation flag. Raising an error is another option but
+ * it might break backward compatibility.
*/
*maxndim = 0;
*out_is_object = 1;