[pypy-commit] pypy gc-hooks: try to fix translation
antocuni
pypy.commits at gmail.com
Mon Apr 16 05:57:45 EDT 2018
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: gc-hooks
Changeset: r94348:2ca9948f1f76
Date: 2018-04-16 11:57 +0200
http://bitbucket.org/pypy/pypy/changeset/2ca9948f1f76/
Log: try to fix translation
diff --git a/pypy/module/__pypy__/interp_debug.py b/pypy/module/__pypy__/interp_debug.py
--- a/pypy/module/__pypy__/interp_debug.py
+++ b/pypy/module/__pypy__/interp_debug.py
@@ -34,8 +34,12 @@
def debug_get_timestamp_unit(space):
unit = rtimer.get_timestamp_unit()
- try:
- unit_str = rtimer.UNITS[unit]
- except IndexError:
+ if unit == rtimer.UNIT_TSC:
+ unit_str = 'tsc'
+ elif unit == rtimer.UNIT_NS:
+ unit_str = 'ns'
+ elif unit == rtimer.UNIT_QUERY_PERFORMANCE_COUNTER:
+ unit_str = 'QueryPerformanceCounter'
+ else:
unit_str = 'UNKNOWN(%d)' % unit
return space.newtext(unit_str)
diff --git a/rpython/rlib/rtimer.py b/rpython/rlib/rtimer.py
--- a/rpython/rlib/rtimer.py
+++ b/rpython/rlib/rtimer.py
@@ -12,7 +12,6 @@
UNIT_TSC = 0
UNIT_NS = 1 # nanoseconds
UNIT_QUERY_PERFORMANCE_COUNTER = 2
-UNITS = ('tsc', 'ns', 'QueryPerformanceCounter')
def read_timestamp():
# Returns a longlong on 32-bit, and a regular int on 64-bit.
More information about the pypy-commit
mailing list