← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:walblock-binary into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:walblock-binary into launchpad:master.

Commit message:
Treat PostgreSQL dumps as binary

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/407257

Otherwise this crashes on Python 3.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:walblock-binary into launchpad:master.
diff --git a/database/replication/walblock.py b/database/replication/walblock.py
index 0e2b5a9..8cbf8ad 100755
--- a/database/replication/walblock.py
+++ b/database/replication/walblock.py
@@ -47,11 +47,11 @@ def main():
         if options.verbose and notified:
             print(' ... Done', file=sys.stderr)
 
-        chunk = sys.stdin.read(chunk_size)
-        if chunk == '':
-            sys.stdout.flush()
+        chunk = sys.stdin.buffer.read(chunk_size)
+        if chunk == b'':
+            sys.stdout.buffer.flush()
             return 0
-        sys.stdout.write(chunk)
+        sys.stdout.buffer.write(chunk)
 
 
 if __name__ == '__main__':