Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r61037:2c718aa7ab8f
Date: 2013-02-10 03:12 -0800
http://bitbucket.org/pypy/pypy/changeset/2c718aa7ab8f/

Log:    fix test_ll_os_environ on darwin

diff --git a/rpython/rtyper/module/ll_os_environ.py 
b/rpython/rtyper/module/ll_os_environ.py
--- a/rpython/rtyper/module/ll_os_environ.py
+++ b/rpython/rtyper/module/ll_os_environ.py
@@ -109,19 +109,11 @@
     r_putenv(name, '')
 
 if hasattr(__import__(os.name), 'unsetenv'):
-
-    if sys.platform.startswith('darwin'):
-        RETTYPE = lltype.Void
-        os_unsetenv = rffi.llexternal('unsetenv', [rffi.CCHARP], RETTYPE)
-    else:
-        RETTYPE = rffi.INT
-        _os_unsetenv = rffi.llexternal('unsetenv', [rffi.CCHARP], RETTYPE)
-        def os_unsetenv(l_name):
-            return rffi.cast(lltype.Signed, _os_unsetenv(l_name))
+    os_unsetenv = rffi.llexternal('unsetenv', [rffi.CCHARP], rffi.INT)
 
     def unsetenv_llimpl(name):
         l_name = rffi.str2charp(name)
-        error = os_unsetenv(l_name)     # 'error' is None on OS/X
+        error = rffi.cast(lltype.Signed, os_unsetenv(l_name))
         rffi.free_charp(l_name)
         if error:
             raise OSError(rposix.get_errno(), "os_unsetenv failed")
diff --git a/rpython/rtyper/module/test/test_ll_os_environ.py 
b/rpython/rtyper/module/test/test_ll_os_environ.py
--- a/rpython/rtyper/module/test/test_ll_os_environ.py
+++ b/rpython/rtyper/module/test/test_ll_os_environ.py
@@ -2,17 +2,16 @@
 import os
 
 def test_environ_items():
-
     def foo(x):
         if x:
             return len(os.environ.items())
         else:
             return 0
+
     f = compile(foo, [int], backendopt=False)
     assert f(1) > 0
-    
+
 def test_unset_error():
-
     def foo(x):
         if x:
             os.environ['TEST'] = 'STRING'
@@ -25,6 +24,6 @@
             return 2
         else:
             return 0
+
     f = compile(foo, [int], backendopt=False)
     assert f(1) == 1
-    
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to