diff -r 8583d138f436 -r 499b19683c1b mercurial/profiling.py --- a/mercurial/profiling.py Mon Jul 08 22:46:04 2024 +0200 +++ b/mercurial/profiling.py Thu Sep 26 02:58:50 2024 +0200 @@ -71,11 +71,14 @@ # what is going on. other_tool_name = sys.monitoring.get_tool(sys.monitoring.PROFILER_ID) if other_tool_name == "cProfile": - msg = 'cannot recursively call `lsprof`' + msg = b'cannot recursively call `lsprof`' raise error.Abort(msg) from None else: - m = 'failed to start "lsprofile"; another profiler already running: %s' - raise error.Abort(_(m) % other_tool_name) from None + tool = b'' + if other_tool_name: + tool = encoding.strtolocal(other_tool_name) + m = b'failed to start "lsprofile"; another profiler already running: %s' + raise error.Abort(_(m) % tool) from None try: yield finally: