From 99b6a2005b5a5fc8de49a048aab04f08fdf18355 2005-11-15 20:39:39 From: fperez Date: 2005-11-15 20:39:39 Subject: [PATCH] Put .rc attribute in instance earlier, too many methods expect this to be there and it could lead to weird runtime bugs (like the one fixed by the previous commit). --- diff --git a/IPython/ipmaker.py b/IPython/ipmaker.py index d00f433..2f6ff75 100644 --- a/IPython/ipmaker.py +++ b/IPython/ipmaker.py @@ -6,7 +6,7 @@ Requires Python 2.1 or better. This file contains the main make_IPython() starter function. -$Id: ipmaker.py 924 2005-11-15 20:24:31Z fperez $""" +$Id: ipmaker.py 925 2005-11-15 20:39:39Z fperez $""" #***************************************************************************** # Copyright (C) 2001-2004 Fernando Perez. @@ -445,11 +445,15 @@ object? -> Details about 'object'. ?object also works, ?? prints more. #------------------------------------------------------------------------ # Execute user config - # first, create a valid config structure with the right precedence order: - # defaults < rcfile < command line. We make it as a local (IP_rc) to - # avoid a zillion attribute accesses. Right before returning, this will - # be set as IP.rc. - IP_rc = rc_def.copy() + # Create a valid config structure with the right precedence order: + # defaults < rcfile < command line. This needs to be in the instance, so + # that method calls below that rely on it find it. + IP.rc = rc_def.copy() + + # Work with a local alias inside this routine to avoid unnecessary + # attribute lookups. + IP_rc = IP.rc + IP_rc.update(opts_def) if rcfiledata: # now we can update @@ -719,9 +723,6 @@ object? -> Details about 'object'. ?object also works, ?? prints more. # Final banner is a string IP.BANNER = '\n'.join(BANN_P) - # Assign the IP_rc object as an attribute of IP - IP.rc = IP_rc - # Finalize the IPython instance. This assumes the rc structure is fully # in place. IP.post_config_initialization()