diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -109,7 +109,9 @@
     def mimesplit(stream, cur):
         def msgfp(m):
             fp = stringio()
+            # pytype: disable=wrong-arg-types
             g = mail.Generator(fp, mangle_from_=False)
+            # pytype: enable=wrong-arg-types
             g.flatten(m)
             fp.seek(0)
             return fp
diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -26,7 +26,6 @@
 mercurial/localrepo.py        # [attribute-error]
 mercurial/manifest.py         # [unsupported-operands], [wrong-arg-types]
 mercurial/minirst.py          # [unsupported-operands], [attribute-error]
-mercurial/patch.py            # [wrong-arg-types]
 mercurial/pure/osutil.py      # [invalid-typevar], [not-callable]
 mercurial/pure/parsers.py     # [attribute-error]
 mercurial/pycompat.py         # bytes vs str issues
@@ -65,7 +64,6 @@
   >    -x mercurial/localrepo.py \
   >    -x mercurial/manifest.py \
   >    -x mercurial/minirst.py \
-  >    -x mercurial/patch.py \
   >    -x mercurial/pure/osutil.py \
   >    -x mercurial/pure/parsers.py \
   >    -x mercurial/pycompat.py \