From 11bca294719e127355cda35af661d9bad32138e0 2011-10-25 04:07:47 From: MinRK Date: 2011-10-25 04:07:47 Subject: [PATCH] Don't let invalid aliases crash IPython e.g. `ipython --foo-bar=5` would raise a SyntaxError parsing the commmand-line, because `self.config.foo-bar=5` would be evaluated. Syntax Errors on the rhs were already protected, but they could get into the lhs via the alias syntax. closes gh-886 --- diff --git a/IPython/config/loader.py b/IPython/config/loader.py index 7bb8cf3..d7db801 100644 --- a/IPython/config/loader.py +++ b/IPython/config/loader.py @@ -502,7 +502,10 @@ class KeyValueConfigLoader(CommandLineConfigLoader): if '.' not in lhs: # probably a mistyped alias, but not technically illegal warn.warn("Unrecognized alias: '%s', it will probably have no effect."%lhs) - self._exec_config_str(lhs, rhs) + try: + self._exec_config_str(lhs, rhs) + except Exception: + raise ArgumentError("Invalid argument: '%s'" % raw) elif flag_pattern.match(raw): if item in flags: