HyukjinKwon commented on a change in pull request #30309:
URL: https://github.com/apache/spark/pull/30309#discussion_r522976885



##########
File path: python/pyspark/util.py
##########
@@ -75,6 +79,144 @@ def wrapper(*args, **kwargs):
     return wrapper
 
 
+def walk_tb(tb):
+    while tb is not None:
+        yield tb
+        tb = tb.tb_next
+
+
+def try_simplify_traceback(tb):
+    """
+    Simplify the traceback. It removes the tracebacks in the current package, 
and only
+    shows the traceback that is related to the thirdparty and user-specified 
codes.
+
+    Returns
+    -------
+    TracebackType or None
+      Simplified traceback instance. It returns None if it fails to simplify.
+
+    Notes
+    -----
+    This keeps the tracebacks once it sees they are from a different file even
+    though the following tracebacks are from the current package.
+
+    Examples

Review comment:
       I thought it's easier to understand this traceback modification with the 
doctests. But let me know if any of you think it should be converted and placed 
as a proper unittest under `test_xxx.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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to