Base: remove Py2 code
This commit is contained in:
@@ -155,14 +155,8 @@ PyObject* VectorPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
double b = PyFloat_AsDouble(other);
|
||||
return new VectorPy(a * b);
|
||||
}
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
else if (PyInt_Check(other)) {
|
||||
Base::Vector3d a = static_cast<VectorPy*>(self) ->value();
|
||||
long b = PyInt_AsLong(other);
|
||||
#else
|
||||
else if (PyLong_Check(other)) {
|
||||
long b = PyLong_AsLong(other);
|
||||
#endif
|
||||
return new VectorPy(a * (double)b);
|
||||
}
|
||||
else {
|
||||
@@ -176,13 +170,8 @@ PyObject* VectorPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
double b = PyFloat_AsDouble(self);
|
||||
return new VectorPy(a * b);
|
||||
}
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
else if (PyLong_Check(self)) {
|
||||
long b = PyLong_AsLong(self);
|
||||
#else
|
||||
else if (PyInt_Check(self)) {
|
||||
long b = PyInt_AsLong(self);
|
||||
#endif
|
||||
return new VectorPy(a * (double)b);
|
||||
}
|
||||
else {
|
||||
@@ -252,11 +241,7 @@ PyObject * VectorPy::mapping_subscript(PyObject *self, PyObject *item)
|
||||
}
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength, cur, i;
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PySliceObject* slice = reinterpret_cast<PySliceObject*>(item);
|
||||
#else
|
||||
PyObject* slice = item;
|
||||
#endif
|
||||
|
||||
if (PySlice_GetIndicesEx(slice,
|
||||
sequence_length(self),
|
||||
@@ -847,13 +832,6 @@ PyObject * VectorPy::number_or_handler (PyObject* self, PyObject* other)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
int VectorPy::number_coerce_handler (PyObject ** /*self*/, PyObject ** /*other*/)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
PyObject * VectorPy::number_int_handler (PyObject* self)
|
||||
{
|
||||
PyErr_Format(PyExc_TypeError, "int() argument must be a string or a number, not '%s'",
|
||||
@@ -861,32 +839,9 @@ PyObject * VectorPy::number_int_handler (PyObject* self)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyObject * VectorPy::number_long_handler (PyObject* self)
|
||||
{
|
||||
PyErr_Format(PyExc_TypeError, "long() argument must be a string or a number, not '%s'",
|
||||
Py_TYPE(self)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
PyObject * VectorPy::number_float_handler (PyObject* self)
|
||||
{
|
||||
PyErr_Format(PyExc_TypeError, "float() argument must be a string or a number, not '%s'",
|
||||
Py_TYPE(self)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyObject * VectorPy::number_oct_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "oct() argument can't be converted to oct");
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject * VectorPy::number_hex_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "hex() argument can't be converted to hex");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user