[pypy-svn] pypy default: Fix translation of signal module on Windows

amauryfa commits-noreply at bitbucket.org
Wed Jan 19 17:04:53 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r40928:dd6a348cfae1
Date: 2011-01-19 14:49 +0100
http://bitbucket.org/pypy/pypy/changeset/dd6a348cfae1/

Log:	Fix translation of signal module on Windows

diff --git a/pypy/module/signal/interp_signal.py b/pypy/module/signal/interp_signal.py
--- a/pypy/module/signal/interp_signal.py
+++ b/pypy/module/signal/interp_signal.py
@@ -42,25 +42,23 @@
 class CConfig:
     _compilation_info_ = eci
 
+if sys.platform != 'win32':
     for name in """ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF""".split():
-        locals()[name] = rffi_platform.DefinedConstantInteger(name)
+        setattr(CConfig, name, rffi_platform.DefinedConstantInteger(name))
 
-
-    timeval = rffi_platform.Struct(
+    CConfig.timeval = rffi_platform.Struct(
         'struct timeval',
         [('tv_sec', rffi.LONG),
          ('tv_usec', rffi.LONG)])
 
-    itimerval = rffi_platform.Struct(
+    CConfig.itimerval = rffi_platform.Struct(
         'struct itimerval',
-        [('it_value', timeval),
-         ('it_interval', timeval)])
+        [('it_value', CConfig.timeval),
+         ('it_interval', CConfig.timeval)])
 
 for k, v in rffi_platform.configure(CConfig).items():
     globals()[k] = v
 
-itimervalP = rffi.CArrayPtr(itimerval)
-
 def external(name, args, result, **kwds):
     return rffi.llexternal(name, args, result, compilation_info=eci, **kwds)
 
@@ -85,9 +83,11 @@
 c_pause = external('pause', [], rffi.INT)
 c_siginterrupt = external('siginterrupt', [rffi.INT, rffi.INT], rffi.INT)
 
-c_setitimer = external('setitimer',
-                       [rffi.INT, itimervalP, itimervalP], rffi.INT)
-c_getitimer = external('getitimer', [rffi.INT, itimervalP], rffi.INT)
+if sys.platform != 'win32':
+    itimervalP = rffi.CArrayPtr(itimerval)
+    c_setitimer = external('setitimer',
+                           [rffi.INT, itimervalP, itimervalP], rffi.INT)
+    c_getitimer = external('getitimer', [rffi.INT, itimervalP], rffi.INT)
 
 
 class SignalActionFlag(AbstractActionFlag):


More information about the Pypy-commit mailing list