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

arigo at codespeak.net arigo at codespeak.net
Tue Jul 25 12:24:37 CEST 2006


Author: arigo
Date: Tue Jul 25 12:24:34 2006
New Revision: 30513

Modified:
   pypy/dist/pypy/module/posix/__init__.py
   pypy/dist/pypy/rpython/extfunctable.py
   pypy/dist/pypy/translator/c/src/ll_os.h
   pypy/dist/pypy/translator/c/test/test_extfunc.py
Log:
All platforms have os.lstat(), it's just defined to do the same as
os.stat() if there is no notion of symlink.



Modified: pypy/dist/pypy/module/posix/__init__.py
==============================================================================
--- pypy/dist/pypy/module/posix/__init__.py	(original)
+++ pypy/dist/pypy/module/posix/__init__.py	Tue Jul 25 12:24:34 2006
@@ -27,6 +27,7 @@
     'close'     : 'interp_posix.close',
     'fstat'     : 'interp_posix.fstat',
     'stat'      : 'interp_posix.stat',
+    'lstat'     : 'interp_posix.lstat',
     'dup'       : 'interp_posix.dup',
     'dup2'      : 'interp_posix.dup2',
     'system'    : 'interp_posix.system',
@@ -51,8 +52,6 @@
         interpleveldefs['unsetenv'] = 'interp_posix.unsetenv'
     if hasattr(os, 'getpid'):
         interpleveldefs['getpid'] = 'interp_posix.getpid'
-    if hasattr(os, 'lstat'):
-        interpleveldefs['lstat'] = 'interp_posix.lstat'
     if hasattr(os, 'link'):
         interpleveldefs['link'] = 'interp_posix.link'
     if hasattr(os, 'symlink'):

Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py	(original)
+++ pypy/dist/pypy/rpython/extfunctable.py	Tue Jul 25 12:24:34 2006
@@ -196,6 +196,7 @@
     declare(os.ftruncate, noneannotation, 'll_os/ftruncate')
 declare(os.fstat    , statannotation, 'll_os/fstat')
 declare(os.stat     , statannotation, 'll_os/stat')
+declare(os.lstat    , statannotation, 'll_os/lstat')
 declare(os.system   , int           , 'll_os/system')
 declare(os.strerror , str           , 'll_os/strerror')
 declare(os.unlink   , noneannotation, 'll_os/unlink')
@@ -210,8 +211,6 @@
 declare(os.rename   , noneannotation, 'll_os/rename')
 if hasattr(os, 'getpid'):
     declare(os.getpid   , int,            'll_os/getpid')
-if hasattr(os, 'lstat'):
-    declare(os.lstat    , statannotation, 'll_os/lstat')
 if hasattr(os, 'link'):
     declare(os.link     , noneannotation, 'll_os/link')
 if hasattr(os, 'symlink'):

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	Tue Jul 25 12:24:34 2006
@@ -37,6 +37,7 @@
 #       define STAT _stati64
 #       define FSTAT _fstati64
 #       define STRUCT_STAT struct _stati64
+#       define LSTAT STAT
 #else
 #       define STAT stat
 #       define FSTAT fstat
@@ -170,7 +171,6 @@
   return _stat_construct_result_helper(st);
 }
 
-#ifdef LSTAT
 RPySTAT_RESULT* LL_os_lstat(RPyString * fname) {
   STRUCT_STAT st;
   int error = LSTAT(RPyString_AsString(fname), &st);
@@ -180,7 +180,6 @@
   }
   return _stat_construct_result_helper(st);
 }
-#endif
 
 RPySTAT_RESULT* LL_os_fstat(long fd) {
   STRUCT_STAT st;

Modified: pypy/dist/pypy/translator/c/test/test_extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_extfunc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_extfunc.py	Tue Jul 25 12:24:34 2006
@@ -524,7 +524,7 @@
         res = f1()
         assert res == os.getpid()
 
-if hasattr(os, 'lstat'):
+if hasattr(os, 'link'):
     def test_links():
         import stat
         tmpfile1 = str(udir.join('test_links_1.txt'))



More information about the Pypy-commit mailing list