D12337: worker: silence type error when calling pickle
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Mar 4 01:39:56 UTC 2022
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
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 <https://phab.mercurial-scm.org/D12304> /
cc0e059d2af8 <https://phab.mercurial-scm.org/rHGcc0e059d2af84427abe1d58bc79eb4d71ec6f26d>: worker: remove Python 2 support code.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12337
AFFECTED FILES
mercurial/worker.py
CHANGE DETAILS
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:
To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list