diff --git a/mercurial/cext/parsers.pyi b/mercurial/cext/parsers.pyi
--- a/mercurial/cext/parsers.pyi
+++ b/mercurial/cext/parsers.pyi
@@ -12,6 +12,21 @@ from typing import (
 version: int
 versionerrortext: str
 
+# From charencode.c
+
+# Note: the first 'bytes' arg of isasciistr() can be typed as 'Buffer' from the
+# typing_extensions backport, once the related bug is fixed in pytype, or pytype
+# is run under py3.12.  The arg for asciilower(), asciiupper() and
+# jsonescapeu8fast() is checked specifically for the 'bytes' type.  The 'bytes'
+# return is an instance of 'bytes', not an alias for 'Buffer'.
+#
+# https://github.com/google/pytype/issues/1772
+def isasciistr(s: bytes) -> bool: ...
+def asciilower(s: bytes) -> bytes: ...
+def asciiupper(s: bytes) -> bytes: ...
+def jsonescapeu8fast(u8chars: bytes, paranoid: bool) -> bytes: ...
+
+
 class DirstateItem:
     __doc__: str