From 6c940b74d142b3c629c4c65429aec0016a4d480f 2011-09-07 11:22:33 From: Thomas Kluyver Date: 2011-09-07 11:22:33 Subject: [PATCH] Safer loading of default config inside Python 3 config. --- diff --git a/IPython/config/profile/python3/ipython_config.py b/IPython/config/profile/python3/ipython_config.py index 00a4794..f710a56 100644 --- a/IPython/config/profile/python3/ipython_config.py +++ b/IPython/config/profile/python3/ipython_config.py @@ -1,3 +1,11 @@ -# This can be used at any point in a config file to load a sub config -# and merge it into the current one. -load_subconfig('ipython_config.py', profile='default') +c = get_config() + +# If the master config file uses syntax that's invalid in Python 3, we'll skip +# it and just use the factory defaults. +try: + load_subconfig('ipython_config.py', profile='default') +except Exception: + pass +else: + # We reset exec_lines in case they're not compatible with Python 3. + c.InteractiveShellApp.exec_lines = []