wjones127 commented on code in PR #39380:
URL: https://github.com/apache/arrow/pull/39380#discussion_r1446381623


##########
python/pyarrow/src/arrow/python/common.cc:
##########
@@ -131,6 +138,34 @@ class PythonErrorDetail : public StatusDetail {
   }
 
  protected:
+  Result<std::string> FormatImpl() const {
+    PyAcquireGIL lock;
+
+    // Use traceback.format_exception()
+    OwnedRef traceback_module;
+    RETURN_NOT_OK(internal::ImportModule("traceback", &traceback_module));

Review Comment:
   > It seems we are already retrieving the error indicator and saving the 
traceback in PythonErrorDetail class, but can be reading the code wrong.
   
   Yes, the `traceback` module isn't being used to retrieve any errors. They 
are definitely already retrieved.
   
   I am using `traceback.format_exception()` so that our error format is 
consistent with what Python prints normally, which should be easiest for users 
to understand. I could instead manually try to reproduce this format, but 
there's a lot of special logic in 
https://github.com/python/cpython/blob/3.12/Lib/traceback.py



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to