--- a/mercurial/profiling.py Tue Dec 03 09:44:57 2024 -0500
+++ b/mercurial/profiling.py Thu Dec 05 23:22:40 2024 -0500
@@ -341,7 +341,10 @@
exception_type, exception_value, traceback
)
if self._output == b'blackbox':
- val = b'Profile:\n%s' % self._fp.getvalue()
+ fp = self._fp
+ # Help pytype: blackbox output uses io.BytesIO instead of a file
+ assert isinstance(fp, util.stringio)
+ val = b'Profile:\n%s' % fp.getvalue()
# ui.log treats the input as a format string,
# so we need to escape any % signs.
val = val.replace(b'%', b'%%')