1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 08:35:32 +00:00

[cleanup] Fix misc bugs (#8968)

Closes #8816

Authored by: bashonly, seproDev, pukkandan, Grub4k
This commit is contained in:
pukkandan
2024-03-10 19:52:49 +05:30
parent 47ab66db0f
commit 93240fc184
13 changed files with 20 additions and 16 deletions

View File

@ -1424,7 +1424,8 @@ def write_string(s, out=None, encoding=None):
s = re.sub(r'([\r\n]+)', r' \1', s)
enc, buffer = None, out
if 'b' in getattr(out, 'mode', ''):
# `mode` might be `None` (Ref: https://github.com/yt-dlp/yt-dlp/issues/8816)
if 'b' in (getattr(out, 'mode', None) or ''):
enc = encoding or preferredencoding()
elif hasattr(out, 'buffer'):
buffer = out.buffer