[Numpy-svn] r5421 - branches/1.1.x/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Tue Jul 15 12:02:09 CDT 2008


Author: charris
Date: 2008-07-15 12:02:04 -0500 (Tue, 15 Jul 2008)
New Revision: 5421

Modified:
   branches/1.1.x/numpy/core/src/arrayobject.c
   branches/1.1.x/numpy/core/src/ufuncobject.c
Log:
Backport r5399.


Modified: branches/1.1.x/numpy/core/src/arrayobject.c
===================================================================
--- branches/1.1.x/numpy/core/src/arrayobject.c	2008-07-15 16:51:08 UTC (rev 5420)
+++ branches/1.1.x/numpy/core/src/arrayobject.c	2008-07-15 17:02:04 UTC (rev 5421)
@@ -4342,7 +4342,7 @@
     if (repr) {
         if (PyArray_ISEXTENDED(self)) {
             char buf[100];
-            snprintf(buf, sizeof(buf), "%d", self->descr->elsize);
+            PyOS_snprintf(buf, sizeof(buf), "%d", self->descr->elsize);
             sprintf(string+n, ", '%c%s')", self->descr->type, buf);
             ret = PyString_FromStringAndSize(string, n+6+strlen(buf));
         }
@@ -7339,7 +7339,7 @@
         if (PyCObject_Check(ip)) {
             inter=(PyArrayInterface *)PyCObject_AsVoidPtr(ip);
             if (inter->two == 2) {
-                snprintf(buf, 40, "|%c%d", inter->typekind,
+                PyOS_snprintf(buf, 40, "|%c%d", inter->typekind,
                          inter->itemsize);
                 chktype = _array_typedescr_fromstr(buf);
             }
@@ -8520,7 +8520,8 @@
     }
 
     if (thetype == NULL) {
-        snprintf(buf, 40, "%c%c%d", endian, inter->typekind, inter->itemsize);
+        PyOS_snprintf(buf, 40,
+                "%c%c%d", endian, inter->typekind, inter->itemsize);
         if (!(thetype=_array_typedescr_fromstr(buf))) {
             Py_DECREF(attr);
             return NULL;

Modified: branches/1.1.x/numpy/core/src/ufuncobject.c
===================================================================
--- branches/1.1.x/numpy/core/src/ufuncobject.c	2008-07-15 16:51:08 UTC (rev 5420)
+++ branches/1.1.x/numpy/core/src/ufuncobject.c	2008-07-15 17:02:04 UTC (rev 5421)
@@ -670,7 +670,8 @@
 
         switch(method) {
         case UFUNC_ERR_WARN:
-            snprintf(msg, 100, "%s encountered in %s", errtype, name);
+            PyOS_snprintf(msg, sizeof(msg),
+                    "%s encountered in %s", errtype, name);
             if (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) goto fail;
             break;
         case UFUNC_ERR_RAISE:
@@ -714,7 +715,8 @@
                                  errtype, name);
                     goto fail;
                 }
-                snprintf(msg, 100, "Warning: %s encountered in %s\n", errtype, name);
+                PyOS_snprintf(msg, sizeof(msg),
+                        "Warning: %s encountered in %s\n", errtype, name);
                 ret = PyObject_CallMethod(pyfunc, "write", "s", msg);
                 if (ret == NULL) goto fail;
                 Py_DECREF(ret);



More information about the Numpy-svn mailing list