summaryrefslogtreecommitdiff
path: root/numpy/lib/src/_compiled_base.c
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2009-12-06 12:01:33 +0000
committerPauli Virtanen <pav@iki.fi>2009-12-06 12:01:33 +0000
commit272ed1997edfdf53275a903015025d37eaa98444 (patch)
treecbd93fe9ccba12cd037cd5ed6074adc2a864d6d8 /numpy/lib/src/_compiled_base.c
parentb16616a553347358a8476e80b9db3a56c6362c2a (diff)
downloadnumpy-272ed1997edfdf53275a903015025d37eaa98444.tar.gz
3K: lib: fix PyString issues in _compiled_base -- may need revising
Diffstat (limited to 'numpy/lib/src/_compiled_base.c')
-rw-r--r--numpy/lib/src/_compiled_base.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c
index 3a8193f63..4a54ea1a9 100644
--- a/numpy/lib/src/_compiled_base.c
+++ b/numpy/lib/src/_compiled_base.c
@@ -1,6 +1,7 @@
#include "Python.h"
#include "structmember.h"
#include "numpy/noprefix.h"
+#include "npy_config.h"
static intp
incr_slot_(double x, double *bins, intp lbins)
@@ -562,11 +563,20 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
Py_INCREF(Py_None);
return Py_None;
}
+#if defined(NPY_PY3K)
+ if (!PyArg_ParseTuple(args, "OO!", &obj, &PyUnicode_Type, &str)) {
+ return NULL;
+ }
+
+ docstr = PyUnicode_AS_DATA(str);
+#warning XXX -- is this correct at all!?
+#else
if (!PyArg_ParseTuple(args, "OO!", &obj, &PyString_Type, &str)) {
return NULL;
}
docstr = PyString_AS_STRING(str);
+#endif
#define _TESTDOC1(typebase) (obj->ob_type == &Py##typebase##_Type)
#define _TESTDOC2(typebase) (obj->ob_type == Py##typebase##_TypePtr)
@@ -931,10 +941,6 @@ PyMODINIT_FUNC init_compiled_base(void) {
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
- s = PyString_FromString("0.5");
- PyDict_SetItemString(d, "__version__", s);
- Py_DECREF(s);
-
/*
* PyExc_Exception should catch all the standard errors that are
* now raised instead of the string exception "numpy.lib.error".