[pypy-svn] r34401 - in pypy/dist/pypy: module/posix module/signal/test rpython translator/c/src

arigo at codespeak.net arigo at codespeak.net
Wed Nov 8 23:06:30 CET 2006


Author: arigo
Date: Wed Nov  8 23:06:27 2006
New Revision: 34401

Modified:
   pypy/dist/pypy/module/posix/__init__.py
   pypy/dist/pypy/module/signal/test/test_interp_signal.py
   pypy/dist/pypy/module/signal/test/test_signal.py
   pypy/dist/pypy/rpython/extfunctable.py
   pypy/dist/pypy/translator/c/src/ll_os.h
Log:
No os.kill() on Windows (thanks Lameiro).


Modified: pypy/dist/pypy/module/posix/__init__.py
==============================================================================
--- pypy/dist/pypy/module/posix/__init__.py	(original)
+++ pypy/dist/pypy/module/posix/__init__.py	Wed Nov  8 23:06:27 2006
@@ -47,7 +47,6 @@
     'chmod'     : 'interp_posix.chmod',
     'rename'    : 'interp_posix.rename',
     '_exit'     : 'interp_posix._exit',
-    'kill'      : 'interp_posix.kill',
     #'getuid'    : 'interp_posix.getuid',
     #'geteuid'   : 'interp_posix.geteuid',
     }
@@ -57,6 +56,8 @@
         interpleveldefs['putenv'] = 'interp_posix.putenv'
     if hasattr(posix, 'unsetenv'): # note: emulated in os
         interpleveldefs['unsetenv'] = 'interp_posix.unsetenv'
+    if hasattr(os, 'kill'):
+        interpleveldefs['kill'] = 'interp_posix.kill'
     if hasattr(os, 'getpid'):
         interpleveldefs['getpid'] = 'interp_posix.getpid'
     if hasattr(os, 'link'):

Modified: pypy/dist/pypy/module/signal/test/test_interp_signal.py
==============================================================================
--- pypy/dist/pypy/module/signal/test/test_interp_signal.py	(original)
+++ pypy/dist/pypy/module/signal/test/test_interp_signal.py	Wed Nov  8 23:06:27 2006
@@ -1,7 +1,11 @@
-import os
+import os, py
 from pypy.translator.c.test.test_genc import compile
 from pypy.module.signal import interp_signal
 
+def setup_module(mod):
+    if not hasattr(os, 'kill') or not hasattr(os, 'getpid'):
+        py.test.skip("requires os.kill() and os.getpid()")
+
 
 def check(expected):
     res = interp_signal.pypysig_poll()

Modified: pypy/dist/pypy/module/signal/test/test_signal.py
==============================================================================
--- pypy/dist/pypy/module/signal/test/test_signal.py	(original)
+++ pypy/dist/pypy/module/signal/test/test_signal.py	Wed Nov  8 23:06:27 2006
@@ -1,8 +1,11 @@
+import os
 from pypy.conftest import gettestobjspace
 
 class AppTestSignal:
 
     def setup_class(cls):
+        if not hasattr(os, 'kill') or not hasattr(os, 'getpid'):
+            py.test.skip("requires os.kill() and os.getpid()")
         space = gettestobjspace(usemodules=['signal'])
         cls.space = space
         cls.w_signal = space.appexec([], "(): import signal; return signal")

Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py	(original)
+++ pypy/dist/pypy/rpython/extfunctable.py	Wed Nov  8 23:06:27 2006
@@ -217,7 +217,8 @@
 declare(os.chmod    , noneannotation, 'll_os/chmod')
 declare(os.rename   , noneannotation, 'll_os/rename')
 declare(os._exit    , noneannotation, 'll_os/_exit')
-declare(os.kill     , noneannotation, 'll_os/kill')
+if hasattr(os, 'kill'):
+    declare(os.kill     , noneannotation, 'll_os/kill')
 if hasattr(os, 'getpid'):
     declare(os.getpid   , int,            'll_os/getpid')
 if hasattr(os, 'link'):

Modified: pypy/dist/pypy/translator/c/src/ll_os.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_os.h	(original)
+++ pypy/dist/pypy/translator/c/src/ll_os.h	Wed Nov  8 23:06:27 2006
@@ -344,12 +344,14 @@
 	return getpid();
 }
 
+#ifdef HAVE_KILL
 void LL_os_kill(int pid, int sig) {
     int error = kill(pid, sig);
     if (error != 0) {
 	RPYTHON_RAISE_OSERROR(errno);
     }
 }
+#endif
 
 #ifdef HAVE_FILESYSTEM_WITH_LINKS
 



More information about the Pypy-commit mailing list