# HG changeset patch # User Gregory Szorc <gregory.szorc@gmail.com> # Date 1646357960 28800 # Thu Mar 03 17:39:20 2022 -0800 # Node ID a0674e916fb6c8a154a3a2f2e097bfd189e603bb # Parent 46b3ecfb16e2781ede9752d972dc22f0e1dfea87 worker: silence type error when calling pickle pytype is complaining that the argument to `pickle.load()` is not an `IO`. pytype isn't wrong: `_blockingreader` doesn't implement `io.RawIOBase`, only `read()` and `readline()`. But it appears this is enough for pickle. So we silence the false positive. This fixes a regression introduced by D12304 / cc0e059d2af8: worker: remove Python 2 support code. Differential Revision: https://phab.mercurial-scm.org/D12337 diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -279,7 +279,11 @@ while openpipes > 0: for key, events in selector.select(): try: + # The pytype error likely goes away on a modern version of + # pytype having a modern typeshed snapshot. + # pytype: disable=wrong-arg-types res = pickle.load(_blockingreader(key.fileobj)) + # pytype: enable=wrong-arg-types if hasretval and res[0]: retval.update(res[1]) else: