[Numpy-discussion] stderr

Charles R Harris charlesr.harris@gmail....
Fri Jun 26 22:30:20 CDT 2009


There are a few spots where messages are printed to stderr. Some of these
look almost like debugging stuff, for instance

NPY_NO_EXPORT void
format_@name@(char *buf, size_t buflen, @name@ val, unsigned int prec)
{
   /* XXX: Find a correct size here for format string */
   char format[64], *res;
   size_t i, cnt;

   PyOS_snprintf(format, sizeof(format), _FMT1, prec);
   res = NumPyOS_ascii_format@type@(buf, buflen, format, val, 0);
   if (res == NULL) {
       fprintf(stderr, "Error while formatting\n");
       return;
   }

   /* If nothing but digits after sign, append ".0" */
   cnt = strlen(buf);
   for (i = (val < 0) ? 1 : 0; i < cnt; ++i) {
       if (!isdigit(Py_CHARMASK(buf[i]))) {
           break;
       }
   }
   if (i == cnt && buflen >= cnt + 3) {
       strcpy(&buf[cnt],".0");
   }
}

Do we want to raise an error here? Alternatively, we could use an assert.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090626/3119f857/attachment.html 


More information about the Numpy-discussion mailing list