From d8393e88fb1086ef0acb388b6b4b0eeae6b85a37 2013-05-15 17:53:21 From: MinRK Date: 2013-05-15 17:53:21 Subject: [PATCH] define `__file__` in config files --- diff --git a/IPython/config/loader.py b/IPython/config/loader.py index 12cf91f..c94ebb8 100644 --- a/IPython/config/loader.py +++ b/IPython/config/loader.py @@ -321,7 +321,11 @@ class PyFileConfigLoader(FileConfigLoader): def get_config(): return self.config - namespace = dict(load_subconfig=load_subconfig, get_config=get_config) + namespace = dict( + load_subconfig=load_subconfig, + get_config=get_config, + __file__=self.full_filename, + ) fs_encoding = sys.getfilesystemencoding() or 'ascii' conf_filename = self.full_filename.encode(fs_encoding) py3compat.execfile(conf_filename, namespace)