[pypy-svn] r26417 - pypy/dist/pypy/translator/goal

arigo at codespeak.net arigo at codespeak.net
Thu Apr 27 10:22:00 CEST 2006


Author: arigo
Date: Thu Apr 27 10:22:00 2006
New Revision: 26417

Modified:
   pypy/dist/pypy/translator/goal/targetdemomodule.py
Log:
Set up the module's dict automatically, by using r26412 (tismer) which
directly calls the compiled function at import time if it is called
__init__.



Modified: pypy/dist/pypy/translator/goal/targetdemomodule.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetdemomodule.py	(original)
+++ pypy/dist/pypy/translator/goal/targetdemomodule.py	Thu Apr 27 10:22:00 2006
@@ -9,13 +9,16 @@
 module = Module(space, space.wrap('_demo'))
 w_moduledict = module.getdict()
 
-def getdict():
-    return w_moduledict
+def __init__(mod):
+    w_mod = CPyObjSpace.W_Object(mod)
+    w_dict = space.getattr(w_mod, space.wrap('__dict__'))
+    space.call_method(w_dict, 'update', w_moduledict)
+__init__.allow_someobjects = True
 
 # _____ Define and setup target ___
 
 def target(*args):
-    return getdict, [], CPyAnnotatorPolicy(space)
+    return __init__, [object], CPyAnnotatorPolicy(space)
 
 
 if __name__ == '__main__':



More information about the Pypy-commit mailing list