| 90 | const char* type_id() const override { return kErrorDetailTypeId; } |
| 91 | |
| 92 | std::string ToString() const override { |
| 93 | // This is simple enough not to need the GIL |
| 94 | Result<std::string> result = FormatImpl(); |
| 95 | |
| 96 | if (result.ok()) { |
| 97 | return result.ValueOrDie(); |
| 98 | } else { |
| 99 | // Fallback to just the exception type |
| 100 | const auto ty = reinterpret_cast<const PyTypeObject*>(exc_type_.obj()); |
| 101 | return std::string("Python exception: ") + ty->tp_name; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | void RestorePyError() const { |
| 106 | Py_INCREF(exc_type_.obj()); |
nothing calls this directly
no test coverage detected