Skip to contentSkip to conversation

error.py: initialize stdout/stderr to empty strings

PATCH New Alexander Kanavin 1 participant 1 message Mar 1, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 error.py: initialize stdout/stderr to empty strings

This avoids guarding them against NoneType everywhere

---
 modules/errors.py        | 2 +-
 modules/utils/devtool.py | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)
modules/errors.py +1 -1
index fa543f7..48e8b70 100644
@@ -24,7 +24,7 @@
 #
 
 class Error(Exception):
-    def __init__(self, message=None, stdout=None, stderr=None):
+    def __init__(self, message=None, stdout="", stderr=""):
         self.message = message
         self.stdout = stdout
         self.stderr = stderr
modules/utils/devtool.py +1 -4
index e4e028f..c26061f 100644
@@ -19,10 +19,7 @@ class Devtool(object):
             raise DevtoolError("The following devtool command failed: " + operation,
                         e.stdout, e.stderr)
 
-        if stderr is None:
-            return stdout
-        else:
-            return stdout + stderr
+        return stdout + stderr
 
     def upgrade(self, recipe, version = None, revision = None):
         cmd = " upgrade " + recipe
Signature · 1 line
2.30.2