PyObject *result = binary_op1(v, w, op_slot);
if (result == Py_NotImplemented) {
Py_DECREF(Py_NotImplemented);
- PyErr_Format(PyExc_TypeError,
- "unsupported operand type(s) for %s", op_name);
+ PyErr_Format(
+ PyExc_TypeError,
+ "unsupported operand type(s) for %s: '%s' and '%s'",
+ op_name,
+ v->ob_type->tp_name,
+ w->ob_type->tp_name);
return NULL;
}
return result;
if (c >= 0)
return x;
}
-
- PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for %s",
- op_name);
+
+ if (z == Py_None)
+ PyErr_Format(
+ PyExc_TypeError,
+ "unsupported operand type(s) for ** or pow(): "
+ "'%s' and '%s'",
+ v->ob_type->tp_name,
+ w->ob_type->tp_name);
+ else
+ PyErr_Format(
+ PyExc_TypeError,
+ "unsupported operand type(s) for pow(): "
+ "'%s', '%s', '%s'",
+ v->ob_type->tp_name,
+ w->ob_type->tp_name,
+ z->ob_type->tp_name);
return NULL;
}
result = (*m->sq_concat)(v, w);
}
else {
- PyErr_SetString(PyExc_TypeError,
- "unsupported operand types for +");
+ PyErr_Format(
+ PyExc_TypeError,
+ "unsupported operand types for +: '%s' and '%s'",
+ v->ob_type->tp_name,
+ w->ob_type->tp_name);
result = NULL;
}
}
return PyUnicode_Concat((PyObject *)a, bb);
#endif
PyErr_Format(PyExc_TypeError,
- "cannot add type \"%.200s\" to string",
+ "cannot concatenate 'str' and '%.200s' objects",
bb->ob_type->tp_name);
return NULL;
}