qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH v3 4/5] iotests: make qemu_img raise on non-zero rc by defaul


From: Hanna Reitz
Subject: Re: [PATCH v3 4/5] iotests: make qemu_img raise on non-zero rc by default
Date: Thu, 17 Mar 2022 16:58:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 17.03.22 16:24, John Snow wrote:
On Thu, Mar 17, 2022 at 6:25 AM Hanna Reitz <hreitz@redhat.com> wrote:
On 08.03.22 02:57, John Snow wrote:
+    if check and subp.returncode or (subp.returncode < 0):
I wouldn’t expect these parentheses here in any other language, are they
required in Python?

It's not required, I just find it easier to read this way.

Oh well.

+        raise VerboseProcessError(
+            subp.returncode, full_args,
+            output=subp.stdout,
+            stderr=subp.stderr,
+        )
I trust these parameters are correct, because it really sometimes seems
like Python doc doesn’t want to tell me about the arguments that
constructors take.  (The only thing I found out is that `stdout` works
as an alias for `output`, so passing `output` here and reading
`self.stdout` in `VerboseProcesError` should(tm) be fine.)

import subprocess
help(subprocess.CalledProcessError)
  |  __init__(self, returncode, cmd, output=None, stderr=None)
  |      Initialize self.  See help(type(self)) for accurate signature.

It should be fine :tm:

The things you learn...

Hanna




reply via email to

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