From bced1f03304b7362661d86078afbae54cc825be0 Mon Sep 17 00:00:00 2001 From: Matt McDonald Date: Tue, 10 Oct 2023 10:20:57 -0700 Subject: [PATCH] Remove definitions for `CanonicalCode()`, `error_message()`, and `get_source_location_trace_str()` PiperOrigin-RevId: 572292285 --- pybind11_abseil/register_status_bindings.cc | 20 -------------------- pybind11_abseil/tests/status_test.py | 3 --- 2 files changed, 23 deletions(-) diff --git a/pybind11_abseil/register_status_bindings.cc b/pybind11_abseil/register_status_bindings.cc index fa5c1a0..1fc21ca 100644 --- a/pybind11_abseil/register_status_bindings.cc +++ b/pybind11_abseil/register_status_bindings.cc @@ -280,13 +280,6 @@ void RegisterStatusBindings(module m) { auto output = absl::StrCat(s.message(), " [", code_str, "]"); return decode_utf8_replace(output); }) - .def("get_source_location_trace_str", - [](const absl::Status& s) -> std::string { - if (!s.ok()) { - {}; - } - return {}; - }) .def_static("OkStatus", []() { handle py_singleton(pybind11_abseil::PyOkStatusSingleton()); @@ -296,14 +289,6 @@ void RegisterStatusBindings(module m) { return py_singleton; }) .def("raw_code", &absl::Status::raw_code) - .def("CanonicalCode", - [](const absl::Status& self) { - return static_cast(self.code()); - }) - .def("error_message", - [](const absl::Status& self) { - return decode_utf8_replace(self.message()); - }) .def("IgnoreError", &absl::Status::IgnoreError) .def("SetPayload", [](absl::Status& self, absl::string_view type_url, @@ -425,9 +410,6 @@ void RegisterStatusBindings(module m) { def __str__(self): return self._status.status_not_ok_str() - def get_source_location_trace_str(self): - return self._status.get_source_location_trace_str() - def __eq__(self, other): if not isinstance(other, StatusNotOk): return NotImplemented @@ -435,8 +417,6 @@ void RegisterStatusBindings(module m) { rhs = Status(InitFromTag.capsule, other._status) return lhs == rhs - # NOTE: The absl::SourceLocation is lost. - # It is impossible to serialize-deserialize. def __reduce_ex__(self, protocol): del protocol return (type(self), (self._status,)) diff --git a/pybind11_abseil/tests/status_test.py b/pybind11_abseil/tests/status_test.py index 105e74c..ddb41c3 100644 --- a/pybind11_abseil/tests/status_test.py +++ b/pybind11_abseil/tests/status_test.py @@ -64,8 +64,6 @@ def test_create_ok_status(self): ok_status = status.Status.OkStatus() self.assertEqual(ok_status.to_string(), 'OK') self.assertEqual(ok_status.raw_code(), 0) - self.assertEqual(ok_status.CanonicalCode(), 0) - self.assertEqual(ok_status.error_message(), '') self.assertIsNone(ok_status.IgnoreError()) def test_error_message_malformed_utf8(self): @@ -73,7 +71,6 @@ def test_error_message_malformed_utf8(self): stx80 = status.invalid_argument_error(malformed_utf8) self.assertEqual(stx80.message(), '�') self.assertEqual(stx80.message_bytes(), malformed_utf8) - self.assertEqual(stx80.error_message(), '�') self.assertEqual(stx80.to_string(), 'INVALID_ARGUMENT: �') self.assertEqual(str(stx80), 'INVALID_ARGUMENT: �') e = status.StatusNotOk(stx80)