diff --git a/src/ifcwrap/utils/type_conversion.i b/src/ifcwrap/utils/type_conversion.i index 1fc5df9010..41cded53a7 100644 --- a/src/ifcwrap/utils/type_conversion.i +++ b/src/ifcwrap/utils/type_conversion.i @@ -161,7 +161,7 @@ template <> int cast_pyobject(PyObject* element) { - return static_cast(PyInt_AsLong(element)); + return static_cast(PyLong_AsLong(element)); } template <> @@ -255,9 +255,9 @@ } } - PyObject* pythonize(const int& t) { return PyInt_FromLong(t); } + PyObject* pythonize(const int& t) { return PyLong_FromLong(t); } PyObject* pythonize(const int64_t& t) { return PyLong_FromLongLong(t); } - PyObject* pythonize(const unsigned int& t) { return PyInt_FromLong(t); } + PyObject* pythonize(const unsigned int& t) { return PyLong_FromLong(t); } PyObject* pythonize(const bool& t) { return PyBool_FromLong(t); } PyObject* pythonize(const boost::logic::tribool& t) { return boost::logic::indeterminate(t) ? PyUnicode_FromString("UNKNOWN") : PyBool_FromLong((bool)t) ;} PyObject* pythonize(const double& t) { return PyFloat_FromDouble(t); } diff --git a/src/ifcwrap/utils/typemaps_out.i b/src/ifcwrap/utils/typemaps_out.i index 3e41e6f08a..735dc22136 100644 --- a/src/ifcwrap/utils/typemaps_out.i +++ b/src/ifcwrap/utils/typemaps_out.i @@ -1,5 +1,5 @@ %typemap(out) ifcopenshell::argument_type { - $result = SWIG_Python_str_FromChar(ifcopenshell::argument_type_to_string($1)); + $result = PyUnicode_FromString(ifcopenshell::argument_type_to_string($1)); } %typemap(out) ifcopenshell::declaration* { @@ -24,7 +24,7 @@ %typemap(out) ifcopenshell::simple_type::data_type { static const char* const data_type_strings[] = {"binary", "boolean", "integer", "logical", "number", "real", "string"}; - $result = SWIG_Python_str_FromChar(data_type_strings[(int)$1]); + $result = PyUnicode_FromString(data_type_strings[(int)$1]); } %typemap(out) attribute_value {