diff --git a/tensorflow/python/lib/core/pybind11_lib.h b/tensorflow/python/lib/core/pybind11_lib.h index a0fb45a5152..e464728a515 100644 --- a/tensorflow/python/lib/core/pybind11_lib.h +++ b/tensorflow/python/lib/core/pybind11_lib.h @@ -55,12 +55,12 @@ inline py::object PyoOrThrow(PyObject* ptr) { return Pyo(ptr); } -void ThrowTypeError(const char* error_message) { +[[noreturn]] void ThrowTypeError(const char* error_message) { PyErr_SetString(PyExc_TypeError, error_message); throw pybind11::error_already_set(); } -void ThrowValueError(const char* error_message) { +[[noreturn]] void ThrowValueError(const char* error_message) { PyErr_SetString(PyExc_ValueError, error_message); throw pybind11::error_already_set(); } diff --git a/tensorflow/python/tfe_wrapper.cc b/tensorflow/python/tfe_wrapper.cc index 8a843ebe07a..d2ee9a4c57e 100644 --- a/tensorflow/python/tfe_wrapper.cc +++ b/tensorflow/python/tfe_wrapper.cc @@ -400,7 +400,6 @@ PYBIND11_MODULE(_pywrap_tfe, m) { absl::StrFormat("No matching devices found for '%s'", device_name) .c_str()); } - CHECK(matched_device); tensorflow::AllocatorAttributes attrs; tensorflow::Allocator* allocator = matched_device->GetAllocator(attrs); @@ -414,7 +413,6 @@ PYBIND11_MODULE(_pywrap_tfe, m) { absl::StrFormat("Allocator stats not available for device '%s'", matched_device->name()) .c_str()); - LOG(FATAL) << "Unreachable"; }); // XLA Eager Logic