Author: Armin Rigo <ar...@tunes.org>
Branch: py3k
Changeset: r87488:160c8ded58c9
Date: 2016-10-01 10:46 +0200
http://bitbucket.org/pypy/pypy/changeset/160c8ded58c9/

Log:    hg merge default

diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py
--- a/pypy/module/__pypy__/__init__.py
+++ b/pypy/module/__pypy__/__init__.py
@@ -19,12 +19,8 @@
     if rtime.HAS_CLOCK_GETTIME:
         interpleveldefs["clock_gettime"] = "interp_time.clock_gettime"
         interpleveldefs["clock_getres"] = "interp_time.clock_getres"
-        for name in [
-            "CLOCK_REALTIME", "CLOCK_MONOTONIC", "CLOCK_MONOTONIC_RAW",
-            "CLOCK_PROCESS_CPUTIME_ID", "CLOCK_THREAD_CPUTIME_ID"
-        ]:
-            if getattr(rtime, name) is not None:
-                interpleveldefs[name] = "space.wrap(%d)" % getattr(rtime, name)
+        for name in rtime.ALL_DEFINED_CLOCKS:
+            interpleveldefs[name] = "space.wrap(%d)" % getattr(rtime, name)
 
 
 class ThreadModule(MixedModule):
diff --git a/rpython/rlib/rtime.py b/rpython/rlib/rtime.py
--- a/rpython/rlib/rtime.py
+++ b/rpython/rlib/rtime.py
@@ -73,10 +73,15 @@
 
 constant_names = ['RUSAGE_SELF', 'EINTR',
                   'CLOCK_REALTIME',
+                  'CLOCK_REALTIME_COARSE',
                   'CLOCK_MONOTONIC',
+                  'CLOCK_MONOTONIC_COARSE',
                   'CLOCK_MONOTONIC_RAW',
+                  'CLOCK_BOOTTIME',
                   'CLOCK_PROCESS_CPUTIME_ID',
                   'CLOCK_THREAD_CPUTIME_ID',
+                  'CLOCK_HIGHRES',
+                  'CLOCK_PROF',
 ]
 for const in constant_names:
     setattr(CConfig, const, rffi_platform.DefinedConstantInteger(const))
@@ -195,6 +200,9 @@
     # clock_gettime().  The issue is that we'd need a way that keeps
     # nanosecond precision, depending on the usage, so we can't have a
     # nice function that returns the time as a float.
+    ALL_DEFINED_CLOCKS = [const for const in constant_names
+                          if const.startswith('CLOCK_')
+                             and globals()[const] is not None]
 
 if need_rusage:
     RUSAGE = RUSAGE
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to