Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: rposix-for-3
Changeset: r83549:f79b252981fb
Date: 2016-04-06 20:00 +0100
http://bitbucket.org/pypy/pypy/changeset/f79b252981fb/

Log:    Reuse rposix definition of TIMESPEC in rposix_stat

diff --git a/rpython/rlib/rposix_stat.py b/rpython/rlib/rposix_stat.py
--- a/rpython/rlib/rposix_stat.py
+++ b/rpython/rlib/rposix_stat.py
@@ -36,13 +36,12 @@
 #   sub-second timestamps.
 # - TIMESPEC is defined when the "struct stat" contains st_atim field.
 
-if sys.platform.startswith('linux') or sys.platform.startswith('openbsd'):
-    TIMESPEC = platform.Struct('struct timespec',
-                               [('tv_sec', rffi.TIME_T),
-                                ('tv_nsec', rffi.LONG)])
-else:
+try:
+    from rpython.rlib.rposix import TIMESPEC
+except ImportError:
     TIMESPEC = None
 
+
 # all possible fields - some of them are not available on all platforms
 ALL_STAT_FIELDS = [
     ("st_mode",      lltype.Signed),
@@ -300,13 +299,6 @@
     includes=INCLUDES
 )
 
-if TIMESPEC is not None:
-    class CConfig_for_timespec:
-        _compilation_info_ = compilation_info
-        TIMESPEC = TIMESPEC
-    TIMESPEC = lltype.Ptr(
-        platform.configure(CConfig_for_timespec)['TIMESPEC'])
-
 
 def posix_declaration(try_to_add=None):
     global STAT_STRUCT, STATVFS_STRUCT
@@ -322,7 +314,7 @@
                 if _name == originalname:
                     # replace the 'st_atime' field of type rffi.DOUBLE
                     # with a field 'st_atim' of type 'struct timespec'
-                    lst[i] = (timespecname, TIMESPEC.TO)
+                    lst[i] = (timespecname, TIMESPEC)
                     break
 
         _expand(LL_STAT_FIELDS, 'st_atime', 'st_atim')
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to