
(Sending an email instead of just asking in irc so I don't keep spamming the question) In the 3.3 branch, there is this failing test: http://buildbot.pypy.org/summary/longrepr?testname=AppTestMagic.%28%29.test_save_module_content_for_future_reload&builder=own-linux-x86-64&build=4372&mod=module.__pypy__.test.test_magic I made this change to make it not fail: https://bitbucket.org/marky1991/pypy/commits/afb2b3cd9535399043722f3d822762e... The call chain is thus (mostly pseudocode here): (test code) reload(module) lib-python/3/imp.py, in reload loader.load_module(module.name) lib-python/3/importlib/_bootstrap.py, in load_module init_builtin(module.name) pypy/module/imp/interp_imp.py, in init_builtin space.getbuiltinmodule(module.name) pypy/interpreter/baseobjspace.py sys.modules.get(module.name) The last method in that chain, space.getbuiltinmodule, has a parameter force_init, which defaults to False. If you pass it as true, we avoid the (rpython equivalent to) sys.modules.get(module_name) code, getting the module object and successfully calling init() on it. (The failing test needs reload() to invoke module.init()) In the commit pasted above, I changed init_builtin to call space.getbuiltinmodule with force_init=True. This fixes reload, but I would think that this would be wrong for nonreload scenarios. (I've checked the py3k branch, which has this test (which passes locally), and it passes force_init=True if the finder's modtype is C_BUILTIN) However, I don't see a good way to conditionalize the passing of force_init. Does anyone have any suggestions as to how to handle this issue? (Given what I've found in py3k's code, is my change actually a valid fix?) If anyone has time to reply, feel free to just ping me in irc if I'm on. Thanks