[Numpy-svn] r8149 - trunk/numpy/core/src/multiarray
numpy-svn at scipy.org
numpy-svn at scipy.org
Sat Feb 20 13:08:44 EST 2010
Author: ptvirtan
Date: 2010-02-20 12:08:44 -0600 (Sat, 20 Feb 2010)
New Revision: 8149
Modified:
trunk/numpy/core/src/multiarray/ctors.c
Log:
3K: BUG: do not convert Bytes/Unicode via PEP 3118 buffers -- use 'S/U#' instead
Modified: trunk/numpy/core/src/multiarray/ctors.c
===================================================================
--- trunk/numpy/core/src/multiarray/ctors.c 2010-02-20 18:08:27 UTC (rev 8148)
+++ trunk/numpy/core/src/multiarray/ctors.c 2010-02-20 18:08:44 UTC (rev 8149)
@@ -1752,11 +1752,11 @@
}
r = Array_FromPyScalar(op, newtype);
}
-#if PY_VERSION_HEX >= 0x02070000
- else if (_array_from_buffer_3118(op, &r) == 0) {
+ else if (!PyBytes_Check(op) && !PyUnicode_Check(op) &&
+ _array_from_buffer_3118(op, &r) == 0) {
+ /* PEP 3118 buffer -- but don't accept Bytes objects here */
r = r;
}
-#endif
else if (PyArray_HasArrayInterfaceType(op, newtype, context, r)) {
PyObject *new;
if (r == NULL) {
@@ -3231,8 +3231,6 @@
Py_INCREF(buf);
}
-#warning XXX: Should implement support for the new buffer interface here!
-
if (PyObject_AsWriteBuffer(buf, (void *)&data, &ts) == -1) {
write = 0;
PyErr_Clear();
More information about the Numpy-svn
mailing list