[pypy-svn] r39923 - pypy/dist/pypy/translator/benchmark

tismer at codespeak.net tismer at codespeak.net
Sun Mar 4 21:23:56 CET 2007

Author: tismer
Date: Sun Mar  4 21:23:53 2007
New Revision: 39923

checking in as far as I got. There is some bug that shows up only after running all the tests. I want to track this down before continuing integrating a gadfly test. Please feel free to jump in if you like, but leave that bug to me - chris

Added: pypy/dist/pypy/translator/benchmark/gadtest.py
--- (empty file)
+++ pypy/dist/pypy/translator/benchmark/gadtest.py	Sun Mar  4 21:23:53 2007
@@ -0,0 +1,53 @@
+This file contains some monkeypatching for Gadfly, depending on
+the options for pypy-c things are patched or not.
+There is some bug related to files and marshal that prevented me
+to finish this stuff.
+    Make paths independent from an actual install of Gadfly
+    integrate benchmark into benchmarks.py
+    maybe extract a few parts from Gadfly's test to make it take
+    less time
+    If instead anybody likes to continue from here, please feel free.
+    I was too much occupated by everything else.
+    cheers - chris
+import site
+gadfly asks for InstanceType. We need to cheat for new style classes.
+Also time.gmtime does not always exist in PyPy. We simply patch it in.
+# depending on the buils, we may or may not have gmtime. Just make it work.
+import time
+    time.gmtime
+except AttributeError:
+    time.gmtime = time.time
+# do we have oldstyle classes? If not, just cheat.
+import types
+class _X: pass
+if type(_X) is not types.ClassType:
+    print 'emulating old-style classes by monkeypatching'
+    _isinstance = isinstance
+    def isinstance(ob, klass):
+        if klass is types.InstanceType:
+            return ob.__class__.__module__ != '__builtin__'
+        return _isinstance(ob, klass)
+    import __builtin__
+    __builtin__.isinstance = isinstance
+    _type = type
+    def type(ob):
+        tp = _type(ob)
+        if ob.__class__.__module__ != '__builtin__':
+            return types.InstanceType
+    print 'using real old-style classes (slow ATM)'
\ No newline at end of file

More information about the Pypy-commit mailing list