Commit 5709904d authored by Joseph Weston's avatar Joseph Weston
Browse files

modify Python `int` and `long` type handling.

Followed http://python3porting.com/cextensions.html#changes-in-python
to convert references to PyInt to PyLong
parent 72e600ce
......@@ -9,6 +9,11 @@
#ifndef CONVERSION_HH
#define CONVERSION_HH
#if PY_MAJOR_VERSION >= 3
#define PyInt_FromLong PyLong_FromLong
#define PyInt_AsLong PyLong_AsLong
#endif
#include <complex>
typedef std::complex<double> Complex;
......
......@@ -17,8 +17,12 @@ int dtype_converter(const PyObject *ob, Dtype *dtype)
{
if (ob == Py_None) {
*dtype = default_dtype;
#if PY_MAJOR_VERSION < 3
} else if (ob == (PyObject *)(&PyInt_Type) ||
ob == (PyObject *)(&PyLong_Type)) {
#else
} else if (ob == (PyObject *)(&PyLong_Type)) {
#endif
*dtype = LONG;
} else if (ob == (PyObject *)(&PyFloat_Type)) {
*dtype = DOUBLE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment