# HG changeset patch # User Matt Harbison # Date 1727565099 14400 # Node ID d94e21b5b69367785db420a7bec960e62ab69445 # Parent 2d51b0cf707cc456438b2384cc943988a1301cc8 mdiff: tweak calls into `bdiff.fixws` to match its type hints It turns out that protocol classes can be used for modules too, which is great because all of the dynamically loaded modules (and their attributes) are currently inferred as `Any`. See the next commit for details. A protocol class for the `bdiff` module detected this (trivial) mismatch, so correct it first. The various implementations of this method are typed as taking a `bool`. The `cext` implementation parses its arguments with `PyArg_ParseTuple(args, "Sb:fixws", &s, &allws)`, which wants an `int`. But experimenting in `hg debugshell` under py38, passing `True` or `False` to `cext.fixws()` also works. We can change the implementation to use "p" (which was introduced in py33) instead of "b", but that's beyond the scope of this. diff -r 2d51b0cf707c -r d94e21b5b693 mercurial/mdiff.py --- a/mercurial/mdiff.py Tue Oct 01 15:04:06 2024 -0400 +++ b/mercurial/mdiff.py Sat Sep 28 19:11:39 2024 -0400 @@ -105,9 +105,9 @@ def wsclean(opts, text, blank=True): if opts.ignorews: - text = bdiff.fixws(text, 1) + text = bdiff.fixws(text, True) elif opts.ignorewsamount: - text = bdiff.fixws(text, 0) + text = bdiff.fixws(text, False) if blank and opts.ignoreblanklines: text = re.sub(b'\n+', b'\n', text).strip(b'\n') if opts.ignorewseol: