[pypy-svn] r44280 - in pypy/branch/kill-ctypes/pypy/rpython/module: . test

fijal at codespeak.net fijal at codespeak.net
Fri Jun 15 13:38:06 CEST 2007


Author: fijal
Date: Fri Jun 15 13:38:00 2007
New Revision: 44280

Modified:
   pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py
   pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py
Log:
Add os.WIFSIGNALED on rpython level


Modified: pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py	Fri Jun 15 13:38:00 2007
@@ -133,6 +133,18 @@
 register_external(os.open, [str, int, int], int, "ll_os.open",
                   llimpl=os_open_lltypeimpl, oofakeimpl=os_open_oofakeimpl)
 
+def fake_WIFSIGNALED(status):
+    return int(os.WIFSIGNALED(status))
+
+os_WIFSIGNALED = rffi.llexternal('WIFSIGNALED', [lltype.Signed], lltype.Signed,
+                                 _callable=fake_WIFSIGNALED)
+
+def WIFSIGNALED_lltypeimpl(status):
+    return bool(os_WIFSIGNALED(status))
+
+register_external(os.WIFSIGNALED, [int], int, "ll_os.WIFSIGNALED",
+                  llimpl=WIFSIGNALED_lltypeimpl)
+
 class BaseOS:
     __metaclass__ = ClassMethods
 

Modified: pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py	Fri Jun 15 13:38:00 2007
@@ -1,6 +1,7 @@
 import os
 from pypy.tool.udir import udir
 from pypy.tool.pytest.modcheck import skipimporterror
+from pypy.translator.c.test.test_genc import compile
 
 from pypy.rpython.lltypesystem.module.ll_os import Implementation as impl
 import sys
@@ -100,3 +101,11 @@
     compared_with = os.listdir(dirname)
     compared_with.sort()
     assert result == compared_with
+
+def test_os_wifsignaled():
+    def fun(s):
+        return os.WIFSIGNALED(s)
+
+    fn = compile(fun, [int])
+    assert fn(0) == False
+    assert fn(1) == True



More information about the Pypy-commit mailing list