Skip to content

Commit

Permalink
lib: use bytes_to_str() in xlog_rows()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ligurio committed May 5, 2021
1 parent 46bf2ec commit 170dbf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def xlog_rows(xlog_path):
with open(os.devnull, 'w') as devnull:
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=devnull)
for line in process.stdout.readlines():
yield json.loads(line)
yield json.loads(bytes_to_str(line))


def extract_schema_from_snapshot(snapshot_path):
Expand Down

0 comments on commit 170dbf7

Please sign in to comment.