ipython/ipython — pull request #2460 by bfroehle (2012-10-02 18:41:37+00:00)
Title: Better handling of `__file__` when running scripts.

__Not yet ready for merge__, as it lacks proper tests and the `preserve_keys` context manager should recieve some additional consideration.

This pull request should address the issues raised in #1814:

* Set `__file__` when running `ipython filename.ipy`
* Avoid leaking `__file__` back into the main namespace when using `%run` or when running a script interactively (`ipython -i`).