qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 28/38] qapi/gen.py: update write() to be more idiomatic


From: John Snow
Subject: Re: [PATCH v2 28/38] qapi/gen.py: update write() to be more idiomatic
Date: Wed, 23 Sep 2020 14:37:27 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/23/20 11:26 AM, Eduardo Habkost wrote:
On Tue, Sep 22, 2020 at 05:00:51PM -0400, John Snow wrote:
Make the file handling here just a tiny bit more idiomatic.
(I realize this is heavily subjective.)

Use exist_ok=True for os.makedirs and remove the exception,
use fdopen() to wrap the file descriptor in a File-like object,
and use a context manager for managing the file pointer.

Signed-off-by: John Snow <jsnow@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

I really miss a comment below explaining why we use
open(os.open(pathname, ...), ...) instead of open(pathname, ...).


Not known to me. It was introduced in 907b846653 as part of an effort to reduce rebuild times. Maybe this avoids a modification time change if the file already exists?

Markus?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]