shunping opened a new pull request, #38425:
URL: https://github.com/apache/beam/pull/38425

   A few tests in the Python Precommit suite, including 
`YamlTestingTest::test_create` and `IOTest::test_read_fwf`, 
`InlinePythonTest::test_line_69`, have been reporting ValueError and 
AttributeError exceptions during execution 
(https://github.com/apache/beam/actions/runs/25576871651/job/75086176283). 
   
   The traceback is shwon below:
   ```
     Traceback (most recent call last):
       File 
"/Users/runner/work/beam/beam/sdks/python/apache_beam/dataframe/io.py", line 
587, in flush
         self._underlying.flush()
         ~~~~~~~~~~~~~~~~~~~~~~^^
     ValueError: I/O operation on closed file.
     
     During handling of the above exception, another exception occurred:
     
     Traceback (most recent call last):
       File 
"/Users/runner/work/beam/beam/sdks/python/target/.tox/py313-macos/lib/python3.13/site-packages/apache_beam/runners/worker/bundle_processor.py",
 line 235, in process_encoded
         self.output(decoded_value)
         ~~~~~~~~~~~^^^^^^^^^^^^^^^
     AttributeError: '_TruncatingFileHandle' object has no attribute 'close'. 
Did you mean: 'closed'?
   ```
   
   The issue occurs when `flush()` is called on a `_TruncatingFileHandle` after 
the underlying file has already been closed, leading to a `ValueError`. This 
exception then triggers a secondary AttributeError because 
`_TruncatingFileHandle` lacked a `close()` method
   
   In this PR, we fixed the handling of close and flush operations within 
`_TruncatingFileHandle`.
   


-- 
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