ipython/ipython — pull request #3555 by takluyver (2013-07-05 23:53:56+00:00)
Title: Simplify caching of modules with %run

Previously, we cleared and re-used a single FakeModule instance in which to run scripts, and cached copies of the modules' namespaces to prevent them from being cleared. Now, we cache one FakeModule instance per script file, clearing it and re-using it if the same script is re-run.

I've assumed that `new_main_mod` and `cache_main_mod` don't count as public APIs; they're certainly bizarre corners that I hope no-one else has needed to use directly. Fixing this would be much harder if we have to preserve their signatures.

This closes #3547, and also fixes another test that was marked as a known failure. (Entirely clean test run on IPython.core!)

Pinging @fperez, as I think you're the most familiar with this code.