message: Check overflows when converting to float32 in eager.
diff: @@ -356,7 +356,21 @@ const char* ConvertOneFloat(PyObject* v, T* out) {
  return nullptr;
  }
  if (TF_PREDICT_TRUE(PyFloat_Check(v))) {
  - *out = PyFloat_AS_DOUBLE(v);
  + double as_double = PyFloat_AsDouble(v);
  + // Handle infinity.
  + if (as_double == std::numeric_limits<double>::infinity()) {
  + *out = std::numeric_limits<T>::infinity();
  + return nullptr;
  + } else if (as_double == -1 * std::numeric_limits<double>::infinity()) {
  + *out = -1 * std::numeric_limits<T>::infinity();
  + return nullptr;
  + }
  + // Check for overflow.
  + if (as_double > std::numeric_limits<T>::max() ||
  + as_double < std::numeric_limits<T>::lowest()) {
  + return ErrorOutOfRangeDouble;
  + }
  + *out = static_cast<T>(as_double);
  return nullptr;
  }
  #if PY_MAJOR_VERSION < 3
  