[pypy-commit] pypy more-rposix: Fix translation

amauryfa noreply at buildbot.pypy.org
Mon Nov 10 18:05:14 CET 2014


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: more-rposix
Changeset: r74430:6527530048c9
Date: 2014-11-10 18:04 +0100
http://bitbucket.org/pypy/pypy/changeset/6527530048c9/

Log:	Fix translation

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -1,5 +1,4 @@
 from pypy.interpreter.mixedmodule import MixedModule
-from rpython.rtyper.module.ll_os import RegisterOs
 
 import os
 exec 'import %s as posix' % os.name
@@ -172,7 +171,9 @@
     if hasattr(os, 'chroot'):
         interpleveldefs['chroot'] = 'interp_posix.chroot'
 
-    for name in RegisterOs.w_star:
+    for name in ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
+                 'WIFSIGNALED', 'WIFEXITED',
+                 'WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']:
         if hasattr(os, name):
             interpleveldefs[name] = 'interp_posix.' + name
 
diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -6,7 +6,6 @@
 from rpython.rlib.rarithmetic import r_longlong
 from rpython.rlib.unroll import unrolling_iterable
 from rpython.rtyper.module import ll_os_stat
-from rpython.rtyper.module.ll_os import RegisterOs
 
 from pypy.interpreter.gateway import unwrap_spec
 from pypy.interpreter.error import OperationError, wrap_oserror, wrap_oserror2
@@ -1203,7 +1202,7 @@
         raise wrap_oserror(space, e)
 
 def declare_new_w_star(name):
-    if name in RegisterOs.w_star_returning_int:
+    if name in ('WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG'):
         @unwrap_spec(status=c_int)
         def WSTAR(space, status):
             return space.wrap(getattr(os, name)(status))
@@ -1215,7 +1214,9 @@
     WSTAR.func_name = name
     return WSTAR
 
-for name in RegisterOs.w_star:
+for name in ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
+             'WIFSIGNALED', 'WIFEXITED',
+             'WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']:
     if hasattr(os, name):
         func = declare_new_w_star(name)
         globals()[name] = func
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -6,7 +6,6 @@
 from rpython.tool.udir import udir
 from pypy.tool.pytest.objspace import gettestobjspace
 from pypy.conftest import pypydir
-from rpython.rtyper.module.ll_os import RegisterOs
 from rpython.translator.c.test.test_extfunc import need_sparse_files
 import os
 import py
@@ -576,7 +575,9 @@
         raises(TypeError, "os.utime('xxx', 3)")
         raises(OSError, "os.utime('somefilewhichihopewouldneverappearhere', None)")
 
-    for name in RegisterOs.w_star:
+    for name in ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
+                 'WIFSIGNALED', 'WIFEXITED',
+                 'WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']:
         if hasattr(os, name):
             values = [0, 1, 127, 128, 255]
             code = py.code.Source("""
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -831,7 +831,7 @@
 
 @replace_os_function('ttyname')
 def ttyname(fd):
-    l_name = os_ttyname(fd)
+    l_name = c_ttyname(fd)
     if not l_name:
         raise OSError(get_errno(), "ttyname raised")
     return rffi.charp2str(l_name)


More information about the pypy-commit mailing list