equal
deleted
inserted
replaced
69 # python >=3.12 prevent more than one profiler to run at the same |
69 # python >=3.12 prevent more than one profiler to run at the same |
70 # time, tries to improve the report to help the user understand |
70 # time, tries to improve the report to help the user understand |
71 # what is going on. |
71 # what is going on. |
72 other_tool_name = sys.monitoring.get_tool(sys.monitoring.PROFILER_ID) |
72 other_tool_name = sys.monitoring.get_tool(sys.monitoring.PROFILER_ID) |
73 if other_tool_name == "cProfile": |
73 if other_tool_name == "cProfile": |
74 msg = 'cannot recursively call `lsprof`' |
74 msg = b'cannot recursively call `lsprof`' |
75 raise error.Abort(msg) from None |
75 raise error.Abort(msg) from None |
76 else: |
76 else: |
77 m = 'failed to start "lsprofile"; another profiler already running: %s' |
77 tool = b'<unknown>' |
78 raise error.Abort(_(m) % other_tool_name) from None |
78 if other_tool_name: |
|
79 tool = encoding.strtolocal(other_tool_name) |
|
80 m = b'failed to start "lsprofile"; another profiler already running: %s' |
|
81 raise error.Abort(_(m) % tool) from None |
79 try: |
82 try: |
80 yield |
83 yield |
81 finally: |
84 finally: |
82 p.disable() |
85 p.disable() |
83 |
86 |