comparison mercurial/util.py @ 49909:1d1b244a91b6

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 16 Dec 2022 14:24:02 -0500
parents 54114bba7c7e
children ffeeaeb2d142
comparison
equal deleted inserted replaced
49908:54114bba7c7e 49909:1d1b244a91b6
640 This variation of ``bufferedinputpipe`` can notify observers about 640 This variation of ``bufferedinputpipe`` can notify observers about
641 ``os.read()`` events. It also re-publishes other events, such as 641 ``os.read()`` events. It also re-publishes other events, such as
642 ``read()`` and ``readline()``. 642 ``read()`` and ``readline()``.
643 """ 643 """
644 644
645 def _fillbuffer(self): 645 def _fillbuffer(self, size=_chunksize):
646 res = super(observedbufferedinputpipe, self)._fillbuffer() 646 res = super(observedbufferedinputpipe, self)._fillbuffer(size=size)
647 647
648 fn = getattr(self._input._observer, 'osread', None) 648 fn = getattr(self._input._observer, 'osread', None)
649 if fn: 649 if fn:
650 fn(res, _chunksize) 650 fn(res, size)
651 651
652 return res 652 return res
653 653
654 # We use different observer methods because the operation isn't 654 # We use different observer methods because the operation isn't
655 # performed on the actual file object but on us. 655 # performed on the actual file object but on us.