Remove unnecessary type checks since PyFloat_AsDouble() will convert the value
to floating point if possible anyway, and if not, will raise an appropriate exception.
This commit is contained in:
parent
273d36e4ba
commit
cf19bc7f74
@ -198,14 +198,6 @@ static int NumberVar_SetValueDecimal(udt_Variable *var, uint32_t pos,
|
||||
static int NumberVar_SetValueFloat(udt_Variable *var, uint32_t pos,
|
||||
dpiData *data, PyObject *value)
|
||||
{
|
||||
if (!PyFloat_Check(value) &&
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
!PyInt_Check(value) &&
|
||||
#endif
|
||||
!PyLong_Check(value)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expecting float");
|
||||
return -1;
|
||||
}
|
||||
data->value.asDouble = PyFloat_AsDouble(value);
|
||||
if (PyErr_Occurred())
|
||||
return -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user