comparison mercurial/worker.py @ 48912:a0674e916fb6

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 03 Mar 2022 17:39:20 -0800
parents cc0e059d2af8
children 642e31cb55f0
comparison
equal deleted inserted replaced
48911:46b3ecfb16e2 48912:a0674e916fb6
277 try: 277 try:
278 openpipes = len(pipes) 278 openpipes = len(pipes)
279 while openpipes > 0: 279 while openpipes > 0:
280 for key, events in selector.select(): 280 for key, events in selector.select():
281 try: 281 try:
282 # The pytype error likely goes away on a modern version of
283 # pytype having a modern typeshed snapshot.
284 # pytype: disable=wrong-arg-types
282 res = pickle.load(_blockingreader(key.fileobj)) 285 res = pickle.load(_blockingreader(key.fileobj))
286 # pytype: enable=wrong-arg-types
283 if hasretval and res[0]: 287 if hasretval and res[0]:
284 retval.update(res[1]) 288 retval.update(res[1])
285 else: 289 else:
286 yield res 290 yield res
287 except EOFError: 291 except EOFError: