gemini-code-assist[bot] commented on code in PR #39405:
URL: https://github.com/apache/beam/pull/39405#discussion_r3622348087


##########
sdks/python/apache_beam/runners/worker/sdk_worker.py:
##########
@@ -559,7 +559,15 @@ def discard(self, instruction_id, exception):
     """
     processor = None
     with self._lock:
-      self.failed_instruction_ids[instruction_id] = exception
+      tb_str = "".join(traceback.format_exception(exception))

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   In Python versions prior to 3.10, `traceback.format_exception` does not 
accept a single exception object as a positional argument and will raise a 
`TypeError` (missing `value` and `tb` arguments). Since Apache Beam supports 
Python 3.8 and 3.9, you should pass `type(exception), exception, 
exception.__traceback__` to maintain backward compatibility.
   
   ```python
         tb_str = "".join(
             traceback.format_exception(
                 type(exception), exception, exception.__traceback__))
   ```



-- 
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: [email protected]

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

Reply via email to