Grub4K opened a new issue, #36992:
URL: https://github.com/apache/airflow/issues/36992

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Using `'b' in sys.stdout.mode` (see 
https://github.com/yt-dlp/yt-dlp/issues/8816) results in an error
   
   ### What you think should happen instead?
   
   `sys.stdout` and related should be of type `TextIO`. [`typing`, line 
3165](<https://github.com/python/cpython/blob/1e4f00ebd8db44a031b61eed0803b4c3d731aed7/Lib/typing.py#L3165>)
 suggests that TextIO should implement `mode`, `name`, and `encoding` as type 
`str` (alongside other, unrelated ones). Currently, the abstract method 
described in `TextIO` returns `None`, resulting in above error.
   
   ### How to reproduce
   
   ```py
   import sys
   import logging
   import contextlib
   from airflow.utils.log.logging_mixin import StreamLogWriter
   
   log = logging.getLogger("test")
   out = StreamLogWriter(log, logging.INFO)
   with contextlib.redirect_stdout(out):
       is_binary = "b" in sys.stdout.mode
       print(f"stdout {is_binary=}")
   ```
   resulting in
   ```
   TypeError: argument of type 'NoneType' is not iterable
   ```
   
   ### Operating System
   
   N/A
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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