[pypy-svn] r48030 - in pypy/dist/pypy/module/posix: . test

fijal at codespeak.net fijal at codespeak.net
Fri Oct 26 11:43:45 CEST 2007


Author: fijal
Date: Fri Oct 26 11:43:45 2007
New Revision: 48030

Modified:
   pypy/dist/pypy/module/posix/__init__.py
   pypy/dist/pypy/module/posix/interp_posix.py
   pypy/dist/pypy/module/posix/test/test_posix2.py
Log:
Add os.getgid


Modified: pypy/dist/pypy/module/posix/__init__.py
==============================================================================
--- pypy/dist/pypy/module/posix/__init__.py	(original)
+++ pypy/dist/pypy/module/posix/__init__.py	Fri Oct 26 11:43:45 2007
@@ -86,6 +86,8 @@
     if hasattr(os, 'getuid'):
         interpleveldefs['getuid'] = 'interp_posix.getuid'
         interpleveldefs['geteuid'] = 'interp_posix.geteuid'
+    if hasattr(os, 'getgid'):
+        interpleveldefs['getgid'] = 'interp_posix.getgid'
     
     for name in RegisterOs.w_star:
         if hasattr(os, name):

Modified: pypy/dist/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/dist/pypy/module/posix/interp_posix.py	(original)
+++ pypy/dist/pypy/module/posix/interp_posix.py	Fri Oct 26 11:43:45 2007
@@ -541,6 +541,14 @@
     return space.wrap(os.getuid())
 getuid.unwrap_spec = [ObjSpace]
 
+def getgid(space):
+    """ getgid() -> gid
+    
+    Return the current process's group id.
+    """
+    return space.wrap(os.getgid())
+getgid.unwrap_spec = [ObjSpace]
+
 def geteuid(space):
     """ geteuid() -> euid
 

Modified: pypy/dist/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/dist/pypy/module/posix/test/test_posix2.py	(original)
+++ pypy/dist/pypy/module/posix/test/test_posix2.py	Fri Oct 26 11:43:45 2007
@@ -29,6 +29,8 @@
         if hasattr(os, 'getuid'):
             cls.w_getuid = space.wrap(os.getuid())
             cls.w_geteuid = space.wrap(os.geteuid())
+        if hasattr(os, 'getgid'):
+            cls.w_getgid = space.wrap(os.getgid())
     
     def test_posix_is_pypy_s(self): 
         assert self.posix.__file__ 
@@ -276,6 +278,11 @@
             assert os.getuid() == self.getuid
             assert os.geteuid() == self.geteuid
 
+    if hasattr(os, 'getgid'):
+        def test_os_getgid(self):
+            os = self.posix
+            assert os.getgid() == self.getgid
+
     def test_largefile(self):
         os = self.posix
         import sys



More information about the Pypy-commit mailing list