From: Tamir Duberstein <tamird@gmail.com>
To: "Kernel.org Tools" <tools@kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
Tamir Duberstein <tamird@gmail.com>
Subject: [PATCH RESEND b4 2/5] Avoid file descriptor leak
Date: Fri, 08 Nov 2024 07:31:29 -0500 [thread overview]
Message-ID: <20241108-better-type-annotations-v1-2-ebaf0129d9e1@gmail.com> (raw)
In-Reply-To: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
src/b4/diff.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/b4/diff.py b/src/b4/diff.py
index 63e60f2fc82c95145a897c2dd319283996ed5a8a..743127ef0a1922eace81686e27cd0366f8e42f9c 100644
--- a/src/b4/diff.py
+++ b/src/b4/diff.py
@@ -174,8 +174,8 @@ def main(cmdargs: argparse.Namespace) -> None:
sys.exit(1)
if cmdargs.outdiff is not None:
logger.info('Writing %s', cmdargs.outdiff)
- fh = open(cmdargs.outdiff, 'w')
+ with open(cmdargs.outdiff, 'w') as fh:
+ fh.write(rdiff)
else:
logger.info('---')
- fh = sys.stdout
- fh.write(rdiff)
+ sys.stdout.write(rdiff)
--
2.47.0
next prev parent reply other threads:[~2024-11-08 12:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 12:31 [b4 PATCH RESEND 0/5] Resolve some static typing errors Tamir Duberstein
2024-11-08 12:31 ` [PATCH RESEND b4 1/5] Add development dependencies Tamir Duberstein
2024-11-08 12:31 ` Tamir Duberstein [this message]
2024-11-08 12:31 ` [PATCH RESEND b4 3/5] Correctly type annotate generators Tamir Duberstein
2024-11-08 12:31 ` [PATCH RESEND b4 4/5] Provide overloads for git_run_command Tamir Duberstein
2024-11-08 12:31 ` [PATCH RESEND b4 5/5] Add missing imports Tamir Duberstein
2024-12-03 17:04 ` [b4 PATCH RESEND 0/5] Resolve some static typing errors Tamir Duberstein
2024-12-03 18:44 ` Konstantin Ryabitsev
2025-01-02 18:39 ` Tamir Duberstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241108-better-type-annotations-v1-2-ebaf0129d9e1@gmail.com \
--to=tamird@gmail.com \
--cc=konstantin@linuxfoundation.org \
--cc=tools@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.