[pypy-svn] pypy default: Use rffi.{get, set}intfield() to access these values, which

arigo commits-noreply at bitbucket.org
Fri Jan 21 18:05:46 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41171:cf8dd0b15b8d
Date: 2011-01-21 18:05 +0100
http://bitbucket.org/pypy/pypy/changeset/cf8dd0b15b8d/

Log:	Use rffi.{get,set}intfield() to access these values, which may be
	INT or LONGs, apparently.

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
@@ -291,11 +291,12 @@
 #__________________________________________________________
 
 def timeval_from_double(d, timeval):
-    timeval.c_tv_sec = int(d)
-    timeval.c_tv_usec = int((d - int(d)) * 1000000)
+    rffi.setintfield(timeval, 'c_tv_sec', int(d))
+    rffi.setintfield(timeval, 'c_tv_usec', int((d - int(d)) * 1000000))
 
 def double_from_timeval(tv):
-    return tv.c_tv_sec + (tv.c_tv_usec / 1000000.0)
+    return rffi.getintfield(tv, 'c_tv_sec') + (
+        rffi.getintfield(tv, 'c_tv_usec') / 1000000.0)
 
 def itimer_retval(space, val):
     w_value = space.wrap(double_from_timeval(val.c_it_value))


More information about the Pypy-commit mailing list