Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: py3k
Changeset: r86152:e2f0f6eced42
Date: 2016-08-11 16:47 +0100
http://bitbucket.org/pypy/pypy/changeset/e2f0f6eced42/

Log:    Merged in marky1991/pypy_new/py3k (pull request #468)

        Py3k: Fix Translation for FreeBSD

diff --git a/pypy/module/_posixsubprocess/interp_subprocess.py 
b/pypy/module/_posixsubprocess/interp_subprocess.py
--- a/pypy/module/_posixsubprocess/interp_subprocess.py
+++ b/pypy/module/_posixsubprocess/interp_subprocess.py
@@ -15,8 +15,9 @@
 
 class CConfig:
     _compilation_info_ = ExternalCompilationInfo(
-        includes=['unistd.h', 'sys/syscall.h'])
+        includes=['unistd.h', 'sys/syscall.h', 'sys/stat.h'])
     HAVE_SYS_SYSCALL_H = platform.Has("syscall")
+    HAVE_SYS_STAT_H = platform.Has("stat")
     HAVE_SETSID = platform.Has("setsid")
 
 config = platform.configure(CConfig)
@@ -29,6 +30,8 @@
 compile_extra = []
 if config['HAVE_SYS_SYSCALL_H']:
     compile_extra.append("-DHAVE_SYS_SYSCALL_H")
+if config['HAVE_SYS_STAT_H']:
+    compile_extra.append("-DHAVE_SYS_STAT_H")
 if config['HAVE_SETSID']:
     compile_extra.append("-DHAVE_SETSID")
 
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -159,7 +159,6 @@
         libraries=rtime.libraries
     )
     CLOCKS_PER_SEC = platform.ConstantInteger("CLOCKS_PER_SEC")
-    clock_t = platform.SimpleType("clock_t", rffi.ULONG)
     has_gettimeofday = platform.Has('gettimeofday')
     has_clock_gettime = platform.Has('clock_gettime')
     CLOCK_PROF = platform.DefinedConstantInteger('CLOCK_PROF')
@@ -233,7 +232,6 @@
 HAS_CLOCK_MONOTONIC = cConfig.CLOCK_MONOTONIC is not None
 HAS_MONOTONIC = (_WIN or _MACOSX or
                  (HAS_CLOCK_GETTIME and (HAS_CLOCK_HIGHRES or 
HAS_CLOCK_MONOTONIC)))
-clock_t = cConfig.clock_t
 tm = cConfig.tm
 glob_buf = lltype.malloc(tm, flavor='raw', zero=True, immortal=True)
 
@@ -1030,7 +1028,10 @@
             with lltype.scoped_alloc(rposix.TMS) as tms:
                 ret = rposix.c_times(tms)
                 if rffi.cast(lltype.Signed, ret) != -1:
-                    cpu_time = float(tms.c_tms_utime + tms.c_tms_stime)
+                    cpu_time = float(rffi.cast(lltype.Signed,
+                                               tms.c_tms_utime) +
+                                     rffi.cast(lltype.Signed,
+                                               tms.c_tms_stime))
                     if w_info is not None:
                         _setinfo(space, w_info, "times()",
                                  1.0 / rposix.CLOCK_TICKS_PER_SECOND,
@@ -1038,7 +1039,7 @@
                     return space.wrap(cpu_time / rposix.CLOCK_TICKS_PER_SECOND)
         return clock(space)
 
-_clock = external('clock', [], clock_t)
+_clock = external('clock', [], rposix.CLOCK_T)
 def clock(space, w_info=None):
     """clock() -> floating point number
 
@@ -1052,7 +1053,7 @@
             pass
     value = _clock()
     # Is this casting correct?
-    if value == rffi.cast(clock_t, -1):
+    if intmask(value) == intmask(rffi.cast(rposix.CLOCK_T, -1)):
         raise oefmt(space.w_RuntimeError,
                     "the processor time used is not available or its value"
                     "cannot be represented")
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to