[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/2] analyze-migration.py: fix read_migration_debug_json() return
From: |
Eduardo Habkost |
Subject: |
[PULL 2/2] analyze-migration.py: fix read_migration_debug_json() return type |
Date: |
Fri, 18 Sep 2020 14:04:51 -0400 |
From: Alexey Kirillov <lekiravi@yandex-team.ru>
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>
---
scripts/analyze-migration.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index 95838cbff3..d70ec7d33a 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -97,7 +97,8 @@ class MigrationFile(object):
# 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()
--
2.26.2