Explorar o código

analyze-migration.py: fix read_migration_debug_json() return type

Since we use result of read_migration_debug_json() as JSON formatted string,
we must provide proper type. Before Python 3.6 json.loads() method
support only str typed input.

Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
Message-Id: <20200715152135.20287-1-lekiravi@yandex-team.ru>
[ehabkost: added comment explaining why decode() is needed}
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Alexey Kirillov %!s(int64=5) %!d(string=hai) anos
pai
achega
14f9cec713
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      scripts/analyze-migration.py

+ 2 - 1
scripts/analyze-migration.py

@@ -97,7 +97,8 @@ def read_migration_debug_json(self):
         # Seek back to where we were at the beginning
         self.file.seek(entrypos, 0)
 
-        return data[jsonpos:jsonpos + jsonlen]
+        # explicit decode() needed for Python 3.5 compatibility
+        return data[jsonpos:jsonpos + jsonlen].decode("utf-8")
 
     def close(self):
         self.file.close()