changeset 36614:26a6b62919e2

util: work around Python 3 returning None at EOF instead of '' Differential Revision: https://phab.mercurial-scm.org/D2561
author Augie Fackler <augie@google.com>
date Fri, 02 Mar 2018 14:09:50 -0500
parents f5427483eebe
children ff6b8484400b
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Mar 02 14:09:20 2018 -0500
+++ b/mercurial/util.py	Fri Mar 02 14:09:50 2018 -0500
@@ -729,6 +729,9 @@
     def read(self, res, size=-1):
         if not self.reads:
             return
+        # Python 3 can return None from reads at EOF instead of empty strings.
+        if res is None:
+            res = ''
 
         self.fh.write('%s> read(%d) -> %d' % (self.name, size, len(res)))
         self._writedata(res)