* [PATCH 1/1] analyze-migration.py: fix read_migration_debug_json() return type
@ 2020-07-15 15:21 Alexey Kirillov
2020-07-15 16:06 ` Philippe Mathieu-Daudé
2020-07-27 19:52 ` Eduardo Habkost
0 siblings, 2 replies; 3+ messages in thread
From: Alexey Kirillov @ 2020-07-15 15:21 UTC (permalink / raw)
Cc: qemu-trivial, qemu-devel, yc-core
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>
---
scripts/analyze-migration.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index 95838cbff3..c5f06482cf 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -97,7 +97,7 @@ class MigrationFile(object):
# Seek back to where we were at the beginning
self.file.seek(entrypos, 0)
- return data[jsonpos:jsonpos + jsonlen]
+ return data[jsonpos:jsonpos + jsonlen].decode("utf-8")
def close(self):
self.file.close()
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] analyze-migration.py: fix read_migration_debug_json() return type
2020-07-15 15:21 [PATCH 1/1] analyze-migration.py: fix read_migration_debug_json() return type Alexey Kirillov
@ 2020-07-15 16:06 ` Philippe Mathieu-Daudé
2020-07-27 19:52 ` Eduardo Habkost
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-15 16:06 UTC (permalink / raw)
To: Alexey Kirillov
Cc: qemu-trivial, Cleber Rosa, qemu-devel, yc-core, Eduardo Habkost
Cc'ing Eduardo/Cleber.
On 7/15/20 5:21 PM, Alexey Kirillov wrote:
> 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>
> ---
> scripts/analyze-migration.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
> index 95838cbff3..c5f06482cf 100755
> --- a/scripts/analyze-migration.py
> +++ b/scripts/analyze-migration.py
> @@ -97,7 +97,7 @@ class MigrationFile(object):
> # Seek back to where we were at the beginning
> self.file.seek(entrypos, 0)
>
> - return data[jsonpos:jsonpos + jsonlen]
> + return data[jsonpos:jsonpos + jsonlen].decode("utf-8")
>
> def close(self):
> self.file.close()
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] analyze-migration.py: fix read_migration_debug_json() return type
2020-07-15 15:21 [PATCH 1/1] analyze-migration.py: fix read_migration_debug_json() return type Alexey Kirillov
2020-07-15 16:06 ` Philippe Mathieu-Daudé
@ 2020-07-27 19:52 ` Eduardo Habkost
1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Habkost @ 2020-07-27 19:52 UTC (permalink / raw)
To: Alexey Kirillov; +Cc: qemu-trivial, qemu-devel, yc-core
On Wed, Jul 15, 2020 at 06:21:35PM +0300, Alexey Kirillov wrote:
> 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>
Queued for 5.2, thanks!
I've added a small comment explaining why the explicit decode()
call is needed.
# explicit decode() needed for Python 3.5 compatibility
return data[jsonpos:jsonpos + jsonlen].decode("utf-8")
> ---
> scripts/analyze-migration.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
> index 95838cbff3..c5f06482cf 100755
> --- a/scripts/analyze-migration.py
> +++ b/scripts/analyze-migration.py
> @@ -97,7 +97,7 @@ class MigrationFile(object):
> # Seek back to where we were at the beginning
> self.file.seek(entrypos, 0)
>
> - return data[jsonpos:jsonpos + jsonlen]
> + return data[jsonpos:jsonpos + jsonlen].decode("utf-8")
>
> def close(self):
> self.file.close()
> --
> 2.25.1
>
>
--
Eduardo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-27 19:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 15:21 [PATCH 1/1] analyze-migration.py: fix read_migration_debug_json() return type Alexey Kirillov
2020-07-15 16:06 ` Philippe Mathieu-Daudé
2020-07-27 19:52 ` Eduardo Habkost
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).