[pypy-commit] pypy py3.7: Fix fogotten `time.get_clock_info(thread_time)` (bpo-32025)

Yannick_Jadoul pypy.commits at gmail.com
Mon Dec 30 14:31:57 EST 2019


Author: Yannick Jadoul <yannick.jadoul at belgacom.net>
Branch: py3.7
Changeset: r98416:04c1e6eeb0a7
Date: 2019-12-30 20:31 +0100
http://bitbucket.org/pypy/pypy/changeset/04c1e6eeb0a7/

Log:	Fix fogotten `time.get_clock_info(thread_time)` (bpo-32025)

diff --git a/pypy/module/time/app_time.py b/pypy/module/time/app_time.py
--- a/pypy/module/time/app_time.py
+++ b/pypy/module/time/app_time.py
@@ -50,6 +50,8 @@
         time.perf_counter(info)
     elif name == "process_time":
         time.process_time(info)
+    elif name == "thread_time" and hasattr(time, "thread_time"):
+        time.monotonic(info)
     else:
         raise ValueError("unknown clock")
     return info
diff --git a/pypy/module/time/test/test_time.py b/pypy/module/time/test/test_time.py
--- a/pypy/module/time/test/test_time.py
+++ b/pypy/module/time/test/test_time.py
@@ -565,6 +565,8 @@
         clocks = ['clock', 'perf_counter', 'process_time', 'time']
         if hasattr(time, 'monotonic'):
             clocks.append('monotonic')
+        if hasattr(time, 'thread_time'):
+            clocks.append('thread_time')
         for name in clocks:
             info = time.get_clock_info(name)
             assert isinstance(info.implementation, str)


More information about the pypy-commit mailing list