Permalink
Browse files

BUG: made PyErr_Warn[Ex] in conversion_utils.c python2.4-safe

CH: I removed trailing whitespace and moved the trailing comment
to the next line.
  • Loading branch information...
1 parent 2d7d59a commit 5cb956e433f3f802773559f2d1c01fd380132121 Derek Homeier committed with charris Jun 16, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 numpy/core/src/multiarray/conversion_utils.c
@@ -6,6 +6,7 @@
#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
+#include "numpy/ndarrayobject.h"
#include "npy_config.h"
#include "numpy/npy_3kcompat.h"
@@ -629,6 +630,7 @@ NPY_NO_EXPORT int
PyArray_TypestrConvert(int itemsize, int gentype)
{
int newtype = NPY_NOTYPE;
+ int ret;
switch (gentype) {
case NPY_GENBOOLLTR:
@@ -737,11 +739,11 @@ PyArray_TypestrConvert(int itemsize, int gentype)
break;
case NPY_OBJECTLTR:
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "DType strings 'O4' and 'O8' are deprecated "
+ /* raise PyErr_Warn|Ex depending on version */
+ ret = DEPRECATE("DType strings 'O4' and 'O8' are deprecated "
"because they are platform specific. Use "
- "'O' instead", 0) == 0 &&
- (itemsize == 4 || itemsize == 8)) {
+ "'O' instead");
+ if (ret == 0 && (itemsize == 4 || itemsize == 8)) {
newtype = NPY_OBJECT;
}
break;

1 comment on commit 5cb956e

Contributor

dhomeier commented on 5cb956e Jun 16, 2011

yep, looks good - thanks.

Please sign in to comment.