[pypy-svn] r70309 - pypy/trunk/pypy/interpreter
afa at codespeak.net
afa at codespeak.net
Mon Dec 28 18:01:36 CET 2009
Author: afa
Date: Mon Dec 28 18:01:36 2009
New Revision: 70309
Modified:
pypy/trunk/pypy/interpreter/baseobjspace.py
pypy/trunk/pypy/interpreter/mixedmodule.py
pypy/trunk/pypy/interpreter/module.py
Log:
"svn merge" lost some changes in these files,
just copy them from the branch.
Resetting startup_called to False is specially important,
otherwise after reload(sys) we retrieve the state captured during translation...
Modified: pypy/trunk/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/trunk/pypy/interpreter/baseobjspace.py (original)
+++ pypy/trunk/pypy/interpreter/baseobjspace.py Mon Dec 28 18:01:36 2009
@@ -292,11 +292,9 @@
if w_exitfunc is not None:
self.call_function(w_exitfunc)
from pypy.interpreter.module import Module
- for w_modname in self.unpackiterable(
- self.sys.get('builtin_module_names')):
- modname = self.str_w(w_modname)
- mod = self.interpclass_w(self.getbuiltinmodule(modname))
- if isinstance(mod, Module):
+ for w_mod in self.builtin_modules.values():
+ mod = self.interpclass_w(w_mod)
+ if isinstance(mod, Module) and mod.startup_called:
mod.shutdown(self)
if self.config.objspace.std.withdictmeasurement:
from pypy.objspace.std.dictmultiobject import report
Modified: pypy/trunk/pypy/interpreter/mixedmodule.py
==============================================================================
--- pypy/trunk/pypy/interpreter/mixedmodule.py (original)
+++ pypy/trunk/pypy/interpreter/mixedmodule.py Mon Dec 28 18:01:36 2009
@@ -96,6 +96,7 @@
def _freeze_(self):
self.getdict()
+ self.startup_called = False
# hint for the annotator: Modules can hold state, so they are
# not constant
return False
Modified: pypy/trunk/pypy/interpreter/module.py
==============================================================================
--- pypy/trunk/pypy/interpreter/module.py (original)
+++ pypy/trunk/pypy/interpreter/module.py Mon Dec 28 18:01:36 2009
@@ -30,15 +30,15 @@
self.startup(space)
def startup(self, space):
- """This is called at runtime before the space gets uses to allow
- the module to do initialization at runtime.
+ """This is called at runtime on import to allow the module to
+ do initialization when it is imported for the first time.
"""
def shutdown(self, space):
"""This is called when the space is shut down, just after
- sys.exitfunc().
+ sys.exitfunc(), if the module has been imported.
"""
-
+
def getdict(self):
return self.w_dict
More information about the Pypy-commit
mailing list