Commits

Armin Rigo committed f7cc11b

Fix

  • Participants
  • Parent commits 1bf6c8d
  • Branches stm-thread-2

Comments (0)

Files changed (1)

File pypy/module/signal/stmactionflag.py

 from pypy.interpreter.executioncontext import AbstractActionFlag
 from rpython.rlib import jit
+from rpython.rlib.objectmodel import we_are_translated
 from rpython.rlib.rsignal import pypysig_get_occurred, pypysig_set_occurred
 
 
     # friendly yet.
 
     def get_ticker(self):
-        return pypysig_get_occurred()
+        if we_are_translated():
+            return pypysig_get_occurred()
+        else:
+            return 42
 
     def reset_ticker(self, value):
-        pypysig_set_occurred(value)
+        if we_are_translated():
+            pypysig_set_occurred(value)
 
     def rearm_ticker(self):
-        pypysig_set_occurred(-1)
+        if we_are_translated():
+            pypysig_set_occurred(-1)
 
     def decrement_ticker(self, by):
-        value = pypysig_get_occurred()
-        if self.has_bytecode_counter:    # this 'if' is constant-folded
-            if jit.isconstant(by) and by == 0:
-                pass     # normally constant-folded too
-            else:
-                value -= by
-                pypysig_set_occurred(value)
-        return value
+        if we_are_translated():
+            value = pypysig_get_occurred()
+            if self.has_bytecode_counter:    # this 'if' is constant-folded
+                if jit.isconstant(by) and by == 0:
+                    pass     # normally constant-folded too
+                else:
+                    value -= by
+                    pypysig_set_occurred(value)
+            return value
+        else:
+            return 42