Skip to content

Commit 5af2181

Browse files
ligurioTotktonada
authored andcommitted
lib: use bytes_to_str() in xlog_rows()
Since Python 3.6+ in json.loads() object that should be deserialized can be of type bytes or bytearray. The input encoding should be UTF-8, UTF-16 or UTF-32 [1]. Patch follows up commit 395edeb ('python3: decouple bytes and strings') and it is a part of task with switching to Python 3. 1. https://docs.python.org/3/library/json.html Follows up: #20
1 parent b36f735 commit 5af2181

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def xlog_rows(xlog_path):
312312
with open(os.devnull, 'w') as devnull:
313313
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=devnull)
314314
for line in process.stdout.readlines():
315-
yield json.loads(line)
315+
yield json.loads(bytes_to_str(line))
316316

317317

318318
def extract_schema_from_snapshot(snapshot_path):

0 commit comments

Comments
 (0)