[pypy-svn] r46257 - in pypy/branch/pypy-more-rtti-inprogress/rpython: . module

arigo at codespeak.net arigo at codespeak.net
Mon Sep 3 11:00:24 CEST 2007


Author: arigo
Date: Mon Sep  3 11:00:24 2007
New Revision: 46257

Modified:
   pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py
   pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_time.py
Log:
More Windozification...


Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py	Mon Sep  3 11:00:24 2007
@@ -95,6 +95,9 @@
     __ATTRIBUTES = ['includes', 'include_dirs']
 
     def configure(self, CConfig):
+        classes_seen = self.__dict__.setdefault('__classes_seen', {})
+        if CConfig in classes_seen:
+            return
         from pypy.rpython.tool import rffi_platform as platform
         # copy some stuff
         for item in self.__ATTRIBUTES:
@@ -102,6 +105,7 @@
             if value:
                 setattr(self, '_%s_' % item, value)
         self.__dict__.update(platform.configure(CConfig))
+        classes_seen[CConfig] = True
 
     def llexternal(self, *args, **kwds):
         kwds = kwds.copy()
@@ -117,6 +121,9 @@
             kwds['stringpolicy'] = stringpolicy
         return rffi.llexternal(*args, **kwds)
 
+    def _freeze_(self):
+        return True
+
 class genericcallable(object):
     """ A way to specify the callable annotation, but deferred until
     we have bookkeeper

Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_time.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_time.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_time.py	Mon Sep  3 11:00:24 2007
@@ -19,12 +19,14 @@
     CLOCK_T = platform.SimpleType('clock_t', rffi.INT)
     TIMEVAL = platform.Struct('struct timeval', [('tv_sec', rffi.INT),
                                                  ('tv_usec', rffi.INT)])
-    TIMEB = platform.Struct('struct timeb', [('time', rffi.INT),
-                                             ('millitm', rffi.INT)])
     TIME_T = platform.SimpleType('time_t', rffi.INT)
     HAVE_GETTIMEOFDAY = platform.Has('gettimeofday')
     HAVE_FTIME = platform.Has('ftime')
 
+class CConfigForFTime:
+    TIMEB = platform.Struct('struct timeb', [('time', rffi.INT),
+                                             ('millitm', rffi.INT)])
+
 constant_names = ['CLOCKS_PER_SEC', 'CLK_TCK', 'EINTR']
 for const in constant_names:
     setattr(CConfig, const, platform.DefinedConstantInteger(const))
@@ -41,7 +43,6 @@
             else:
                 self.CLOCKS_PER_SEC = self.CLK_TCK
         self.TIMEVALP = lltype.Ptr(self.TIMEVAL)
-        self.TIMEBP = lltype.Ptr(self.TIMEB)
 
     @registering(time.time)
     def register_time_time(self):
@@ -60,9 +61,9 @@
                 c_gettimeofday = None
             
             if self.HAVE_FTIME:
-                c_ftime = self.llexternal('ftime', [self.TIMEBP], lltype.Void)
-            else:
-                c_ftime = None # not to confuse flow objspace
+                self.configure(CConfigForFTime)
+                c_ftime = self.llexternal('ftime', [lltype.Ptr(self.TIMEB)],
+                                          lltype.Void)
 
             c_time = self.llexternal('time', [rffi.VOIDP], self.TIME_T)
 


More information about the pypy-svn mailing list