util: fix the signature of observedbufferedinputpipe._fillbuffer()
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 16 Dec 2022 14:24:02 -0500
changeset 49814 1d1b244a91b6
parent 49813 54114bba7c7e
child 49815 464fe8b8f474
util: fix the signature of observedbufferedinputpipe._fillbuffer() Flagged by PyCharm, since it didn't match the signature of the method being overridden. The default value in the superclass is also `_chunksize`, and I suspect that the amount read from `osread` should be limited to what is passed in. Only one caller (`bufferedinputpipe.unbufferedread()`) passes this argument, and it passes the max of `_chunksize` and whatever it was passed.
mercurial/util.py
--- a/mercurial/util.py	Fri Dec 16 14:15:09 2022 -0500
+++ b/mercurial/util.py	Fri Dec 16 14:24:02 2022 -0500
@@ -642,12 +642,12 @@
     ``read()`` and ``readline()``.
     """
 
-    def _fillbuffer(self):
-        res = super(observedbufferedinputpipe, self)._fillbuffer()
+    def _fillbuffer(self, size=_chunksize):
+        res = super(observedbufferedinputpipe, self)._fillbuffer(size=size)
 
         fn = getattr(self._input._observer, 'osread', None)
         if fn:
-            fn(res, _chunksize)
+            fn(res, size)
 
         return res