Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitddd7c42

Browse files
authored
bpo-33717: pythoninfo logs information of all clocks (GH-11460)
test.pythoninfo now logs information of all clocks, not only time.time() andtime.perf_counter().
1 parentdf8e1fb commitddd7c42

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

‎Lib/test/pythoninfo.py‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
importre
77
importsys
88
importtraceback
9+
importwarnings
910

1011

1112
defnormalize_text(text):
@@ -380,9 +381,17 @@ def collect_time(info_add):
380381
copy_attributes(info_add,time,'time.%s',attributes)
381382

382383
ifhasattr(time,'get_clock_info'):
383-
forclockin ('time','perf_counter'):
384-
tinfo=time.get_clock_info(clock)
385-
info_add('time.get_clock_info(%s)'%clock,tinfo)
384+
forclockin ('clock','monotonic','perf_counter',
385+
'process_time','thread_time','time'):
386+
try:
387+
# prevent DeprecatingWarning on get_clock_info('clock')
388+
withwarnings.catch_warnings(record=True):
389+
clock_info=time.get_clock_info(clock)
390+
exceptValueError:
391+
# missing clock like time.thread_time()
392+
pass
393+
else:
394+
info_add('time.get_clock_info(%s)'%clock,clock_info)
386395

387396

388397
defcollect_datetime(info_add):
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test.pythoninfo now logs information of all clocks, not only time.time() and
2+
time.perf_counter().

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp