Skip to content

Commit 0fa57e4

Browse files
authored
Rollup merge of #70392 - brain0:fixxpy, r=Mark-Simulacrum
Make x.py compatible with python 3.8. Python 3.8 removes the `time.clock()` function, use `time.perf_counter()` instead.
2 parents 818da9e + a9484d4 commit 0fa57e4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/etc/lldb_batchmode.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,17 @@ def listen():
139139
def start_watchdog():
140140
"""Starts a watchdog thread that will terminate the process after a certain
141141
period of time"""
142-
watchdog_start_time = time.clock()
142+
143+
try:
144+
from time import clock
145+
except ImportError:
146+
from time import perf_counter as clock
147+
148+
watchdog_start_time = clock()
143149
watchdog_max_time = watchdog_start_time + 30
144150

145151
def watchdog():
146-
while time.clock() < watchdog_max_time:
152+
while clock() < watchdog_max_time:
147153
time.sleep(1)
148154
print("TIMEOUT: lldb_batchmode.py has been running for too long. Aborting!")
149155
thread.interrupt_main()

0 commit comments

Comments
 (0)